feat(tv): add seriesName and seasonIndex to Episode data model

This commit is contained in:
2026-05-01 21:28:33 +02:00
parent e738e9637f
commit f304b1f1f5
14 changed files with 39 additions and 3 deletions

View File

@@ -105,7 +105,9 @@ class EpisodeScreenContentTest {
return Episode(
id = UUID.fromString("33333333-3333-3333-3333-333333333333"),
seriesId = seriesId,
seriesName = "Severance",
seasonId = seasonId,
seasonIndex = 2,
index = 4,
title = "The You You Are",
synopsis = "Mark is pulled deeper into Lumon's fractured world as the team chases a clue.",

View File

@@ -425,7 +425,9 @@ class TvHomeContentTest {
return Episode(
id = UUID.fromString(id),
seriesId = seriesId,
seriesName = "Firefly",
seasonId = seasonId,
seasonIndex = 1,
index = 1,
title = title,
synopsis = "A crew member takes the shuttle for a spin and makes a mess.",

View File

@@ -120,7 +120,9 @@ class SeriesScreenContentTest {
Episode(
id = UUID.fromString("44444444-4444-4444-4444-444444444444"),
seriesId = seriesId,
seriesName = "Severance",
seasonId = seasonId,
seasonIndex = 1,
index = 1,
title = "Good News About Hell",
synopsis = "Mark is promoted after an unexpected tragedy.",
@@ -136,7 +138,9 @@ class SeriesScreenContentTest {
Episode(
id = UUID.fromString("55555555-5555-5555-5555-555555555555"),
seriesId = seriesId,
seriesName = "Severance",
seasonId = seasonId,
seasonIndex = 1,
index = 2,
title = "Half Loop",
synopsis = "Mark takes the team out for a sanctioned dinner.",

View File

@@ -95,7 +95,9 @@ class TvFocusedItemHeroTest {
return Episode(
id = UUID.fromString("33333333-3333-3333-3333-333333333333"),
seriesId = UUID.fromString("44444444-4444-4444-4444-444444444444"),
seriesName = "Love, Death & Robots",
seasonId = UUID.fromString("55555555-5555-5555-5555-555555555555"),
seasonIndex = 3,
index = 3,
title = "The Very Pulse of the Machine",
synopsis = "An astronaut faces a strange world alone.",

View File

@@ -126,7 +126,9 @@ class TvHomeHeroStateTest {
episode = Episode(
id = UUID.fromString(id),
seriesId = UUID.fromString("aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa"),
seriesName = "Sample Series",
seasonId = UUID.fromString("bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb"),
seasonIndex = 1,
index = 1,
title = "Next Episode",
synopsis = "Episode synopsis",

View File

@@ -237,7 +237,9 @@ private fun previewEpisode(): Episode {
return Episode(
id = UUID.fromString("33333333-3333-3333-3333-333333333333"),
seriesId = seriesId,
seriesName = "Severance",
seasonId = seasonId,
seasonIndex = 2,
index = 4,
title = "The You You Are",
synopsis = "Mark is pulled deeper into Lumon's fractured world as the team chases a clue that reframes everything they thought they understood.",

View File

@@ -268,7 +268,9 @@ private fun previewSeries(): Series {
Episode(
id = UUID.fromString("aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaa1"),
seriesId = seriesId,
seriesName = "Constellation",
seasonId = seasonOneId,
seasonIndex = 1,
index = 1,
title = "A Fresh Start",
synopsis = "A fractured crew tries to reassemble after a year apart.",
@@ -284,7 +286,9 @@ private fun previewSeries(): Series {
Episode(
id = UUID.fromString("aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaa2"),
seriesId = seriesId,
seriesName = "Constellation",
seasonId = seasonOneId,
seasonIndex = 1,
index = 2,
title = "Signals",
synopsis = "Anomalies around the station point to a cover-up.",
@@ -302,7 +306,9 @@ private fun previewSeries(): Series {
Episode(
id = UUID.fromString("aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaa3"),
seriesId = seriesId,
seriesName = "Constellation",
seasonId = seasonTwoId,
seasonIndex = 2,
index = 1,
title = "Return Window",
synopsis = "A high-risk jump changes the rules of the mission.",

View File

@@ -5,7 +5,9 @@ import java.util.UUID
data class Episode(
val id: UUID,
val seriesId: UUID,
val seriesName: String,
val seasonId: UUID,
val seasonIndex: Int,
val index: Int,
val title: String,
val synopsis: String,

View File

@@ -129,8 +129,8 @@ class EpisodeUiModel : MediaUiModel {
constructor(episode: Episode) {
id = episode.id
primaryText = episode.title
secondaryText = episode.releaseDate
primaryText = episode.seriesName
secondaryText = "${episode.seasonIndex} x ${episode.index} : ${episode.title}"
description = episode.synopsis
prefixImageUrl = episode.imageUrlPrefix
progress = (episode.progress?.toFloat() ?: 0f) / 100f

View File

@@ -95,7 +95,9 @@ fun BaseItemDto.toEpisode(serverUrl: String): Episode {
return Episode(
id = id,
seriesId = seriesId!!,
seriesName = seriesName!!,
seasonId = parentId!!,
seasonIndex = parentIndexNumber!!,
title = name ?: "Unknown title",
index = indexNumber!!,
releaseDate = releaseDate,

View File

@@ -50,7 +50,9 @@ data class CachedSeries(
data class CachedEpisode(
val id: String,
val seriesId: String,
val seriesName: String,
val seasonId: String,
val seasonIndex: Int,
val index: Int,
val title: String,
val synopsis: String,
@@ -208,7 +210,9 @@ fun CachedSeries.toSeries(): Series? {
fun Episode.toCachedEpisode() = CachedEpisode(
id = id.toString(),
seriesId = seriesId.toString(),
seriesName = seriesName,
seasonId = seasonId.toString(),
seasonIndex = seasonIndex,
index = index,
title = title,
synopsis = synopsis,
@@ -229,7 +233,9 @@ fun CachedEpisode.toEpisode(): Episode? {
return Episode(
id = episodeId,
seriesId = seriesUuid,
seriesName = seriesName,
seasonId = seasonUuid,
seasonIndex = seasonIndex,
index = index,
title = title,
synopsis = synopsis,

View File

@@ -21,7 +21,9 @@ import java.util.UUID
data class EpisodeEntity(
@PrimaryKey val id: UUID,
val seriesId: UUID,
val seriesName: String,
val seasonId: UUID,
val seasonIndex: Int,
val index: Int,
val title: String,
val synopsis: String,

View File

@@ -23,7 +23,7 @@ import hu.bbara.purefin.data.offline.room.entity.SmartDownloadEntity
EpisodeEntity::class,
SmartDownloadEntity::class,
],
version = 10,
version = 11,
exportSchema = false
)
@TypeConverters(UuidConverters::class)

View File

@@ -246,7 +246,9 @@ class OfflineRoomMediaLocalDataSource(
private fun Episode.toEntity() = EpisodeEntity(
id = id,
seriesId = seriesId,
seriesName = seriesName,
seasonId = seasonId,
seasonIndex = seasonIndex,
index = index,
title = title,
synopsis = synopsis,
@@ -300,7 +302,9 @@ class OfflineRoomMediaLocalDataSource(
private fun EpisodeEntity.toDomain() = Episode(
id = id,
seriesId = seriesId,
seriesName = seriesName,
seasonId = seasonId,
seasonIndex = seasonIndex,
index = index,
title = title,
synopsis = synopsis,