Skip to content

Commit 8c8f61a

Browse files
committed
Improve show to videoinfo conversion
1 parent dc02c99 commit 8c8f61a

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

app/src/main/java/de/christinecoenen/code/zapp/app/player/VideoInfo.kt

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import android.text.TextUtils
44
import androidx.annotation.DrawableRes
55
import de.christinecoenen.code.zapp.app.settings.repository.StreamQualityBucket
66
import de.christinecoenen.code.zapp.models.channels.ChannelModel
7+
import de.christinecoenen.code.zapp.models.shows.MediathekShow
78
import de.christinecoenen.code.zapp.models.shows.PersistedMediathekShow
89
import de.christinecoenen.code.zapp.models.shows.Quality
910
import java.io.Serializable
@@ -26,16 +27,21 @@ data class VideoInfo(
2627

2728
@JvmStatic
2829
fun fromShow(persistedShow: PersistedMediathekShow): VideoInfo {
29-
val show = persistedShow.mediathekShow
30+
return fromShow(persistedShow.mediathekShow)
31+
.apply {
32+
id = persistedShow.id
33+
filePath = persistedShow.downloadedVideoPath
34+
}
35+
}
3036

37+
@JvmStatic
38+
fun fromShow(show: MediathekShow): VideoInfo {
3139
return VideoInfo(
3240
title = show.title,
3341
url = show.videoUrl
3442
).apply {
35-
id = persistedShow.id
3643
urlHighestQuality = show.getVideoUrl(Quality.High)
3744
urlLowestQuality = show.getVideoUrl(Quality.Low)
38-
filePath = persistedShow.downloadedVideoPath
3945
subtitle = show.topic
4046
subtitleUrl = show.subtitleUrl
4147
hasDuration = true

app/src/main/java/de/christinecoenen/code/zapp/tv2/main/MainActivity.kt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,7 @@ class MainActivity : ComponentActivity() {
6969
MediaCenterScreen(
7070
onShowSelected = { show ->
7171
backStack.add(
72-
PlayerScreenLocation(
73-
// TODO: extend VideoInfo::fromShow
74-
VideoInfo(title = show.title, url = show.videoUrl)
75-
)
72+
PlayerScreenLocation(VideoInfo.fromShow(show))
7673
)
7774
}
7875
)

0 commit comments

Comments
 (0)