Fix music artist listing & show music in collections (#1739)

## Description
Switches to use the Artists API instead of Items API when fetching the
list of artists in a library.

Enables fetching artists, albums, and music videos in a collection.

Also adds titles for the remaining `BaseItemKind` types for future
proofing even if they aren't used anywhere in the app.

### Related issues
Fixes #1733
Fixes #1734
Fixes #1735


### Testing
Emulator, created a new collection with the above. Also verified the
artist query against the web UI

## Screenshots
N/A

## AI or LLM usage
None
This commit is contained in:
Damontecres 2026-07-23 14:23:48 -04:00 • committed by GitHub
parent 00490b14ec
commit 5bc874a9ff
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 134 additions and 35 deletions

View file

@ -10,6 +10,7 @@ import kotlinx.serialization.modules.polymorphic
import kotlinx.serialization.modules.subclass
import org.jellyfin.sdk.api.client.ApiClient
import org.jellyfin.sdk.api.client.Response
import org.jellyfin.sdk.api.client.extensions.artistsApi
import org.jellyfin.sdk.api.client.extensions.genresApi
import org.jellyfin.sdk.api.client.extensions.itemsApi
import org.jellyfin.sdk.api.client.extensions.liveTvApi
@ -21,6 +22,7 @@ import org.jellyfin.sdk.api.client.extensions.tvShowsApi
import org.jellyfin.sdk.api.client.extensions.userLibraryApi
import org.jellyfin.sdk.model.api.BaseItemDtoQueryResult
import org.jellyfin.sdk.model.api.GetProgramsDto
import org.jellyfin.sdk.model.api.request.GetArtistsRequest
import org.jellyfin.sdk.model.api.request.GetEpisodesRequest
import org.jellyfin.sdk.model.api.request.GetGenresRequest
import org.jellyfin.sdk.model.api.request.GetItemsRequest
@ -367,6 +369,25 @@ object GetLiveTvChannelsRequestHandler : RequestHandler<GetLiveTvChannelsRequest
): Response<BaseItemDtoQueryResult> = api.liveTvApi.getLiveTvChannels(request)
}
@Serializable
object GetArtistsHandler : RequestHandler<GetArtistsRequest> {
override fun prepare(
request: GetArtistsRequest,
startIndex: Int,
limit: Int,
enableTotalRecordCount: Boolean,
): GetArtistsRequest =
request.copy(
startIndex = startIndex,
limit = limit,
)
override suspend fun execute(
api: ApiClient,
request: GetArtistsRequest,
): Response<BaseItemDtoQueryResult> = api.artistsApi.getArtists((request))
}
val requestSerializersModule =
SerializersModule {
polymorphic(Any::class) {
@ -382,5 +403,6 @@ val requestSerializersModule =
subclass(GetStudiosRequest::class)
subclass(GetRecordingsRequest::class)
subclass(GetLiveTvChannelsRequest::class)
subclass(GetArtistsHandler::class)
}
}