From be485d4ef324f83da4b7115e8bb8a63e38b05114 Mon Sep 17 00:00:00 2001 From: uy/sun Date: Wed, 8 Jan 2025 04:46:18 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=85=E4=BB=8E=20jellyfin=20=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E5=A4=96=E6=8C=82=E5=AD=97=E5=B9=95=E5=B9=B6=E7=BB=99?= =?UTF-8?q?=E5=AD=97=E5=B9=95=E6=B7=BB=E5=8A=A0=20label=20(#1460)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- datasource/jellyfin/src/BaseJellyfinMediaSource.kt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/datasource/jellyfin/src/BaseJellyfinMediaSource.kt b/datasource/jellyfin/src/BaseJellyfinMediaSource.kt index 08541eb44b..67b2d56ee2 100644 --- a/datasource/jellyfin/src/BaseJellyfinMediaSource.kt +++ b/datasource/jellyfin/src/BaseJellyfinMediaSource.kt @@ -146,15 +146,16 @@ abstract class BaseJellyfinMediaSource(config: MediaSourceConfig) : HttpMediaSou private fun getSubtitles(itemId: String, mediaStreams: List): List { return mediaStreams - .filter { it.Type == "Subtitle" && it.IsTextSubtitleStream } + .filter { it.Type == "Subtitle" && it.IsTextSubtitleStream && it.IsExternal } .map { stream -> Subtitle( uri = getSubtitleUri(itemId, stream.Index, stream.Codec), - language = stream.Title, + language = stream.Language, mimeType = when (stream.Codec.lowercase()) { "ass" -> "text/x-ass" else -> "application/octet-stream" // 默认二进制流 }, + label = stream.Title, ) } } @@ -188,9 +189,11 @@ private class SearchResponse( @Suppress("PropertyName") private data class MediaStream( val Title: String? = null, // 除了字幕以外其他可能没有 + val Language: String? = null, // 字幕语言代码,如 chs val Type: String, val Codec: String, val Index: Int, + val IsExternal: Boolean, // 是否为外挂字幕 val IsTextSubtitleStream: Boolean, )