Update main page
This commit is contained in:
parent
933dc4fd5a
commit
805f63cb0e
4 changed files with 234 additions and 134 deletions
|
|
@ -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,
|
||||
)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue