Skip to content

Commit 35c4cc6

Browse files
committed
1 parent 83843e2 commit 35c4cc6

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

Shared/Extensions/JellyfinAPI/MediaStream.swift

+7-3
Original file line numberDiff line numberDiff line change
@@ -220,14 +220,18 @@ extension [MediaStream] {
220220
func adjustExternalSubtitleIndexes(audioStreamCount: Int) -> [MediaStream] {
221221
guard allSatisfy({ $0.type == .subtitle }) else { return self }
222222
let embeddedSubtitleCount = filter { !($0.isExternal ?? false) }.count
223+
let externalSubtitleCount = filter { $0.isExternal ?? false }.count
223224

224225
var mediaStreams = self
225226

226227
for (i, mediaStream) in mediaStreams.enumerated() {
227-
guard mediaStream.isExternal ?? false else { continue }
228+
// guard mediaStream.isExternal ?? false else { continue }
228229
var copy = mediaStream
229-
copy.index = (copy.index ?? 0) + 1 + embeddedSubtitleCount + audioStreamCount
230-
230+
if copy.isExternal ?? false {
231+
copy.index = (copy.index ?? 0) + 1 + embeddedSubtitleCount + audioStreamCount
232+
} else {
233+
copy.index = (copy.index ?? 0) - externalSubtitleCount
234+
}
231235
mediaStreams[i] = copy
232236
}
233237

Shared/Extensions/JellyfinAPI/SubtitleProfile.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ extension SubtitleProfile {
3434
@ArrayBuilder<SubtitleFormat> containers: () -> [SubtitleFormat]
3535
) -> [SubtitleProfile] {
3636
containers().map {
37-
SubtitleProfile(container: $0.rawValue, method: method)
37+
SubtitleProfile(container: nil, format: $0.rawValue, method: method)
3838
}
3939
}
4040
}

0 commit comments

Comments
 (0)