Files
navidrome/model/datastore.go
T
27d041486c fix(jellyfin): honour every value of repeated list params (#6414)
* fix(jellyfin): honour every value of repeated list params - #6389

Jellyfin's model binder accepts an array query param both as one
comma-separated value and as repeated keys, and @jellyfin/sdk clients
(Jellify) send the latter. parseItemsQuery read IncludeItemTypes with
StringOr, so IncludeItemTypes=MusicArtist&IncludeItemTypes=Audio&...
behaved as an artist-only query and a mixed search silently lost songs,
albums and playlists. Filters had the same single-value read.

knownItemKinds now takes all values of the param, and parseItemFilters
walks them too, keeping the comma splitting each already did. Absent or
all-unknown lists still mean "no type filter", so the inferred-type and
album-default paths are unchanged.

Signed-off-by: yuwk <1729065730@qq.com>

* fix(jellyfin): join repeated query params so every value is parsed

Jellyfin binds a list param as one comma-separated value or as repeated
keys. joinedStrings feeds every value into the parsers that already
split on commas, so IncludeItemTypes, Filters, SortBy, SortOrder, the
artist id lists and Container all accept both spellings.

ArtistIds, AlbumArtistIds and contributingArtistIds now match every
artist in the list instead of only the first. SortOrder is paired with
each SortBy key, and a key past the end of the list reuses the first
direction, which is what Jellyfin's GetOrderBy does. Playlist SearchTerm
is left for a follow-up.

Signed-off-by: Vincent <52391318+ump45nose@users.noreply.github.com>
Co-authored-by: ump45nose <ump45nose@users.noreply.github.com>

* fix(jellyfin): apply multi-id artist filters as a single slice

ORing one contributing-artist filter per id let an album whose album
artist is one of the ids still match as Featured On via another id in
the list. ParticipantIDFilter and NotParticipantIDFilter already accept
a slice, so contributingArtistIds now uses one IN/NOT IN pair over the
whole list. Album and song artist filters do the same, which also avoids
one subquery per id.

Signed-off-by: Vincent <52391318+ump45nose@users.noreply.github.com>
Co-authored-by: ump45nose <ump45nose@users.noreply.github.com>

* refactor(jellyfin): trim comments in repeated list params change

Signed-off-by: Deluan <deluan@navidrome.org>

---------

Signed-off-by: yuwk <1729065730@qq.com>
Signed-off-by: Vincent <52391318+ump45nose@users.noreply.github.com>
Signed-off-by: Deluan <deluan@navidrome.org>
Co-authored-by: ump45nose <ump45nose@users.noreply.github.com>
Co-authored-by: Deluan <deluan@navidrome.org>
2026-11-10 12:41:46 -05:00

51 lines
1.5 KiB
Go

package model
import (
"context"
"github.com/Masterminds/squirrel"
)
type QueryOptions struct {
Sort string
Order string
Max int
Offset int
Filters squirrel.Sqlizer
Seed string // for random sorting
// SortOrders is one "asc"/"desc" per Sort key, kept on every column its mapping expands into.
// Empty means Order applies to every key; a key past the end reuses the first entry.
SortOrders []string
}
type DataStore interface {
Library() LibraryRepository
Folder() FolderRepository
Album() AlbumRepository
Artist() ArtistRepository
MediaFile() MediaFileRepository
Genre() GenreRepository
Tag() TagRepository
Playlist() PlaylistRepository
PlayQueue() PlayQueueRepository
Transcoding() TranscodingRepository
Player() PlayerRepository
Radio() RadioRepository
Share() ShareRepository
Property() PropertyRepository
User() UserRepository
UserProps() UserPropsRepository
ScrobbleBuffer() ScrobbleBufferRepository
Scrobble() ScrobbleRepository
Plugin() PluginRepository
Artwork() ArtworkRepository
ArtworkQueue() ArtworkQueueRepository
WithTx(block func(tx DataStore) error, scope ...string) error
WithTxImmediate(block func(tx DataStore) error, scope ...string) error
// WithTxRetry runs block in a transaction, rerunning it while SQLite reports the database busy.
// For background work only (it can take minutes), and block must be safe to rerun after a rollback.
WithTxRetry(ctx context.Context, block func(ctx context.Context, tx DataStore) error, scope ...string) error
GC(ctx context.Context, libraryIDs ...int) error
}