From d454ee42381e6eb06b7db1e76a94c4281a5ea56c Mon Sep 17 00:00:00 2001 From: KingLucius Date: Sat, 16 Mar 2024 10:42:39 +0200 Subject: [PATCH] Prioritize Trailers over Clips --- SoraStream/src/main/kotlin/com/hexated/SoraStream.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/SoraStream/src/main/kotlin/com/hexated/SoraStream.kt b/SoraStream/src/main/kotlin/com/hexated/SoraStream.kt index be0a43d9..643bc791 100644 --- a/SoraStream/src/main/kotlin/com/hexated/SoraStream.kt +++ b/SoraStream/src/main/kotlin/com/hexated/SoraStream.kt @@ -244,7 +244,8 @@ open class SoraStream : TmdbProvider() { val recommendations = res.recommendations?.results?.mapNotNull { media -> media.toSearchResponse() } - val trailer = res.videos?.results?.map { "https://www.youtube.com/watch?v=${it.key}" } + val trailer = res.videos?.results?.filter { it.type == "Trailer" }?.map { "https://www.youtube.com/watch?v=${it.key}" }.orEmpty() + .ifEmpty { res.videos?.results?.map { "https://www.youtube.com/watch?v=${it.key}" } } return if (type == TvType.TvSeries) { val lastSeason = res.last_episode_to_air?.season_number @@ -785,6 +786,7 @@ open class SoraStream : TmdbProvider() { data class Trailers( @JsonProperty("key") val key: String? = null, + @JsonProperty("type") val type: String? = null, ) data class ResultsTrailer(