feat: add images to libraries on LibrariesContent screen

This commit is contained in:
2026-02-22 12:50:56 +01:00
parent 843bd749b1
commit ce126988d9
10 changed files with 103 additions and 81 deletions

View File

@@ -177,7 +177,7 @@ class InMemoryMediaRepository @Inject constructor(
//TODO add support for playlists
val filteredLibraries =
librariesItem.filter { it.collectionType == CollectionType.MOVIES || it.collectionType == CollectionType.TVSHOWS }
val emptyLibraries = filteredLibraries.map { it.toLibrary() }
val emptyLibraries = filteredLibraries.map { it.toLibrary(serverUrl()) }
_libraries.value = emptyLibraries
val filledLibraries = emptyLibraries.map { library ->
@@ -369,17 +369,27 @@ class InMemoryMediaRepository @Inject constructor(
return userSessionRepository.serverUrl.first()
}
private fun BaseItemDto.toLibrary(): Library {
private fun BaseItemDto.toLibrary(serverUrl: String): Library {
return when (this.collectionType) {
CollectionType.MOVIES -> Library(
id = this.id,
name = this.name!!,
posterUrl = JellyfinImageHelper.toImageUrl(
url = serverUrl,
itemId = this.id,
type = ImageType.PRIMARY
),
type = CollectionType.MOVIES,
movies = emptyList()
)
CollectionType.TVSHOWS -> Library(
id = this.id,
name = this.name!!,
posterUrl = JellyfinImageHelper.toImageUrl(
url = serverUrl,
itemId = this.id,
type = ImageType.PRIMARY
),
type = CollectionType.TVSHOWS,
series = emptyList()
)

View File

@@ -110,7 +110,7 @@ class JellyfinApiClient @Inject constructor(
ItemFields.PARENT_ID,
ItemFields.DATE_LAST_REFRESHED,
ItemFields.OVERVIEW,
ItemFields.SEASON_USER_DATA
ItemFields.SEASON_USER_DATA,
)
suspend fun getLibraryContent(libraryId: UUID): List<BaseItemDto> = withContext(Dispatchers.IO) {
@@ -119,7 +119,7 @@ class JellyfinApiClient @Inject constructor(
}
val getItemsRequest = GetItemsRequest(
userId = getUserId(),
enableImages = false,
enableImages = true,
parentId = libraryId,
fields = itemFields,
enableUserData = true,