release / go (push) Successful in 1m54s
release / web (push) Failing after 5s
release / integration (push) Failing after 3m44s
release / govulncheck (push) Successful in 20s
release / Attach APK to the Release (tag releases only) (push) Canceled after 0s
release / Build + push container image (push) Canceled after 0s
release / Verify release artifacts (tag releases only) (push) Canceled after 0s
release / Build signed APK (push) Canceled after 19s
release / android (push) Canceled after 2m37s
Minstrel is now a viewer of the library it is pointed at. Finding, downloading and filing music moves out of it. Removed from the server: - the request flow (requests, approval, auto-approve) and the wanted list, follows, release profiles and release blocks; - searching indexers, the download clients, the importer, the album lifecycle and missing-file re-acquisition; - the catalogue's discography, search and art (the MusicBrainz release and track-list cache stays, for the duplicate resolver); - Discover: its suggestions of artists not in the library, snoozes, the candidate-artist tag enrichment and its tuning scope; - writes to acquisition tables from moving the library folder and from merging duplicates, the want-list join on Suspect sources, the sealing of acquisition credentials, and the release-group lookup only re-acquisition used. Settling a wrong-slot duplicate no longer sets the release aside: the copies go and their slots show as missing until a good copy is in the library. Removed from the web: Admin > Acquisition and Requests, /requests, /discover, Follow on the artist page, the auto-approve toggle, and the Collection's wanted-list tabs. The Collection is now the library's health: an overview, Reports, Duplicates, Suspect sources and Missing files. The README and docs no longer describe getting music. The tables stay for now; a later migration drops them. The request notification kinds and the Android screens are still to go. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
170 lines
6.8 KiB
TypeScript
170 lines
6.8 KiB
TypeScript
import { createQuery, createInfiniteQuery } from '@tanstack/svelte-query';
|
|
import { api } from './client';
|
|
import { pageGetNextPageParam } from './paging';
|
|
import type {
|
|
ArtistRef,
|
|
ArtistDetail,
|
|
AlbumRef,
|
|
AlbumDetail,
|
|
Page,
|
|
SearchResponse,
|
|
TrackRef
|
|
} from './types';
|
|
|
|
export type ArtistSort = 'alpha' | 'newest';
|
|
export const ARTIST_PAGE_SIZE = 50;
|
|
export const SEARCH_SUMMARY_LIMIT = 10;
|
|
export const SEARCH_FACET_PAGE_SIZE = 50;
|
|
|
|
export const qk = {
|
|
artists: (sort: ArtistSort) => ['artists', { sort }] as const,
|
|
artist: (id: string) => ['artist', id] as const,
|
|
album: (id: string) => ['album', id] as const,
|
|
search: (q: string) => ['search', { q }] as const,
|
|
searchArtists: (q: string) => ['searchArtists', { q }] as const,
|
|
searchAlbums: (q: string) => ['searchAlbums', { q }] as const,
|
|
searchTracks: (q: string) => ['searchTracks', { q }] as const,
|
|
likedIds: () => ['likedIds'] as const,
|
|
likedTracks: () => ['likedTracks'] as const,
|
|
likedAlbums: () => ['likedAlbums'] as const,
|
|
likedArtists: () => ['likedArtists'] as const,
|
|
history: () => ['history'] as const,
|
|
myQuarantine: () => ['myQuarantine'] as const,
|
|
adminQuarantine: () => ['adminQuarantine'] as const,
|
|
adminQuarantineActions: (limit?: number) =>
|
|
['adminQuarantineActions', { limit: limit ?? 50 }] as const,
|
|
adminPlaybackErrors: (resolved?: boolean) =>
|
|
['adminPlaybackErrors', { resolved: resolved ?? false }] as const,
|
|
scanStatus: () => ['scanStatus'] as const,
|
|
adminSummary: () => ['adminSummary'] as const,
|
|
adminStatus: () => ['adminStatus'] as const,
|
|
coverage: () => ['coverage'] as const,
|
|
fingerprintCoverage: () => ['fingerprintCoverage'] as const,
|
|
coverProviders: () => ['coverProviders'] as const,
|
|
tagProviders: () => ['tagProviders'] as const,
|
|
adminUsers: () => ['adminUsers'] as const,
|
|
adminInvites: () => ['adminInvites'] as const,
|
|
adminDiagnostics: (f: Record<string, string | number | undefined>) =>
|
|
['adminDiagnostics', f] as const,
|
|
adminMissingFiles: (offset?: number) =>
|
|
['adminMissingFiles', { offset: offset ?? 0 }] as const,
|
|
adminDuplicates: (view: string = 'review') =>
|
|
['adminDuplicates', { view }] as const,
|
|
adminResolvedDuplicates: () => ['adminResolvedDuplicates'] as const,
|
|
adminSuspectSources: () => ['adminSuspectSources'] as const,
|
|
adminDiagnosticDevices: (userId?: string) =>
|
|
['adminDiagnosticDevices', { userId: userId ?? 'all' }] as const,
|
|
smtpConfig: () => ['smtpConfig'] as const,
|
|
// Notifications inbox. Both keys sit under ['notifications'] so one
|
|
// prefix invalidation refreshes the list and the badge together.
|
|
notifications: () => ['notifications', 'list'] as const,
|
|
notificationsUnread: () => ['notifications', 'unread'] as const,
|
|
notificationSettings: () => ['notificationSettings'] as const,
|
|
home: () => ['home'] as const,
|
|
albumsAlpha: () => ['albumsAlpha'] as const,
|
|
artistTracks: (artistId: string) => ['artistTracks', artistId] as const,
|
|
similarArtists: (artistId: string) => ['similarArtists', artistId] as const,
|
|
artistTopTracks: (artistId: string) => ['artistTopTracks', artistId] as const,
|
|
playlists: (kind?: 'user' | 'system' | 'all') =>
|
|
['playlists', { kind: kind ?? 'user' }] as const,
|
|
playlist: (id: string) => ['playlist', id] as const,
|
|
systemPlaylistsStatus: () => ['systemPlaylistsStatus'] as const,
|
|
// Browse indexes. Keys carry no arguments — both are whole-library
|
|
// indexes, and the per-genre / per-year album lists are fetched outside
|
|
// svelte-query because their selection comes from the URL.
|
|
genres: () => ['genres'] as const,
|
|
albumYears: () => ['albumYears'] as const,
|
|
};
|
|
|
|
export function createArtistsQuery(sort: ArtistSort) {
|
|
return createInfiniteQuery({
|
|
queryKey: qk.artists(sort),
|
|
queryFn: ({ pageParam = 0 }) =>
|
|
api.get<Page<ArtistRef>>(
|
|
`/api/artists?sort=${sort}&limit=${ARTIST_PAGE_SIZE}&offset=${pageParam}`
|
|
),
|
|
initialPageParam: 0,
|
|
getNextPageParam: pageGetNextPageParam<ArtistRef>(),
|
|
});
|
|
}
|
|
|
|
export function createArtistQuery(id: string) {
|
|
return createQuery({
|
|
queryKey: qk.artist(id),
|
|
queryFn: () => api.get<ArtistDetail>(`/api/artists/${id}`),
|
|
});
|
|
}
|
|
|
|
export function createAlbumQuery(id: string) {
|
|
return createQuery({
|
|
queryKey: qk.album(id),
|
|
queryFn: () => api.get<AlbumDetail>(`/api/albums/${id}`),
|
|
});
|
|
}
|
|
|
|
export function createSimilarArtistsQuery(id: string) {
|
|
return createQuery({
|
|
queryKey: qk.similarArtists(id),
|
|
queryFn: () => api.get<ArtistRef[]>(`/api/artists/${id}/similar`),
|
|
enabled: id.length > 0,
|
|
});
|
|
}
|
|
|
|
export function createArtistTopTracksQuery(id: string) {
|
|
return createQuery({
|
|
queryKey: qk.artistTopTracks(id),
|
|
queryFn: () => api.get<TrackRef[]>(`/api/artists/${id}/top-tracks`),
|
|
enabled: id.length > 0,
|
|
});
|
|
}
|
|
|
|
export function createSearchQuery(q: string) {
|
|
return createQuery({
|
|
queryKey: qk.search(q),
|
|
queryFn: () =>
|
|
api.get<SearchResponse>(
|
|
`/api/search?q=${encodeURIComponent(q)}&limit=${SEARCH_SUMMARY_LIMIT}`
|
|
),
|
|
enabled: q.length > 0
|
|
});
|
|
}
|
|
|
|
export function createSearchArtistsInfiniteQuery(q: string) {
|
|
return createInfiniteQuery({
|
|
queryKey: qk.searchArtists(q),
|
|
queryFn: ({ pageParam = 0 }) =>
|
|
api.get<SearchResponse>(
|
|
`/api/search?q=${encodeURIComponent(q)}&limit=${SEARCH_FACET_PAGE_SIZE}&offset=${pageParam}`
|
|
).then((r) => r.artists),
|
|
initialPageParam: 0,
|
|
getNextPageParam: pageGetNextPageParam<ArtistRef>(),
|
|
enabled: q.length > 0
|
|
});
|
|
}
|
|
|
|
export function createSearchAlbumsInfiniteQuery(q: string) {
|
|
return createInfiniteQuery({
|
|
queryKey: qk.searchAlbums(q),
|
|
queryFn: ({ pageParam = 0 }) =>
|
|
api.get<SearchResponse>(
|
|
`/api/search?q=${encodeURIComponent(q)}&limit=${SEARCH_FACET_PAGE_SIZE}&offset=${pageParam}`
|
|
).then((r) => r.albums),
|
|
initialPageParam: 0,
|
|
getNextPageParam: pageGetNextPageParam<AlbumRef>(),
|
|
enabled: q.length > 0
|
|
});
|
|
}
|
|
|
|
export function createSearchTracksInfiniteQuery(q: string) {
|
|
return createInfiniteQuery({
|
|
queryKey: qk.searchTracks(q),
|
|
queryFn: ({ pageParam = 0 }) =>
|
|
api.get<SearchResponse>(
|
|
`/api/search?q=${encodeURIComponent(q)}&limit=${SEARCH_FACET_PAGE_SIZE}&offset=${pageParam}`
|
|
).then((r) => r.tracks),
|
|
initialPageParam: 0,
|
|
getNextPageParam: pageGetNextPageParam<TrackRef>(),
|
|
enabled: q.length > 0
|
|
});
|
|
}
|