mirror of
https://github.com/bbara04/Purefin.git
synced 2026-03-31 17:10:08 +02:00
feat: add images to libraries on LibrariesContent screen
This commit is contained in:
@@ -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()
|
||||
)
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -7,6 +7,7 @@ data class Library(
|
||||
val id: UUID,
|
||||
val name: String,
|
||||
val type: CollectionType,
|
||||
val posterUrl: String,
|
||||
val series: List<Series>? = null,
|
||||
val movies: List<Movie>? = null,
|
||||
) {
|
||||
|
||||
Reference in New Issue
Block a user