Update main page

This commit is contained in:
Damontecres 2025-10-02 15:08:36 -04:00
parent 933dc4fd5a
commit 805f63cb0e
No known key found for this signature in database
4 changed files with 234 additions and 134 deletions

View file

@ -61,6 +61,7 @@ data class BaseItem(
fun from(
dto: BaseItemDto,
api: ApiClient,
useSeriesForPrimary: Boolean = false,
): BaseItem {
val backdropImageUrl =
if (dto.type == BaseItemKind.EPISODE) {
@ -73,9 +74,20 @@ data class BaseItem(
} else {
api.imageApi.getItemImageUrl(dto.id, ImageType.BACKDROP)
}
val primaryImageUrl =
if (useSeriesForPrimary && dto.type == BaseItemKind.EPISODE) {
val seriesId = dto.seriesId
if (seriesId != null) {
api.imageApi.getItemImageUrl(seriesId, ImageType.PRIMARY)
} else {
api.imageApi.getItemImageUrl(dto.id, ImageType.PRIMARY)
}
} else {
api.imageApi.getItemImageUrl(dto.id, ImageType.PRIMARY)
}
return BaseItem(
dto,
api.imageApi.getItemImageUrl(dto.id, ImageType.PRIMARY),
primaryImageUrl,
backdropImageUrl,
)
}