Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/all/jellyfin/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ext {
extName = 'Jellyfin'
extClass = '.JellyfinFactory'
extVersionCode = 32
extVersionCode = 33
extNames = ["Jellyfin (1)", "Jellyfin (2)", "Jellyfin (3)"]
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,28 @@ class Jellyfin(private val suffix: String) : Source(), UnmeteredSource {
}
}

val videoHeaders = headersBuilder()
.add("Authorization", getAuthHeader(deviceInfo, preferences.apiKey))
.build()

if (mediaSource.isRemote && mediaSource.path != null && preferences.useRemote) {
return listOf(
Video(
videoTitle = buildString {
append("Source (Remote)")
mediaSource.name?.let { append("\n$it") }
append("\n${mediaSource.path}")
},
videoUrl = mediaSource.path,
bitrate = Int.MAX_VALUE,
preferred = mediaSource.bitrate == preferences.quality.toInt(),
subtitleTracks = externalSubtitleList,
initialized = true,
),
)
}

val videoBitrate = mediaSource.bitrate!!.toLong().formatBytes().replace("B", "b")
val sessionData = getSessionData(
videoBitrate = Int.MAX_VALUE,
audioBitrate = Int.MAX_VALUE,
Expand All @@ -545,39 +567,23 @@ class Jellyfin(private val suffix: String) : Source(), UnmeteredSource {
subtitleStreamIndex = subtitleTrackIndex?.toString(),
)

val videoBitrate = mediaSource.bitrate!!.toLong().formatBytes().replace("B", "b")
val videoHeaders = headersBuilder()
.add("Authorization", getAuthHeader(deviceInfo, preferences.apiKey))
.build()
val staticUrl = baseUrl.toHttpUrl().newBuilder().apply {
addPathSegment("Videos")
addPathSegment(itemId)
addPathSegment("stream")
addQueryParameter("static", "True")
addQueryParameter("PlaySessionId", sessionData.playSessionId)
}.build().toString()

val staticVideo = if (mediaSource.isRemote && mediaSource.path != null && preferences.useRemote) {
Video(
videoTitle = "Source - ${videoBitrate}ps (Remote)",
videoUrl = mediaSource.path,
bitrate = Int.MAX_VALUE,
preferred = mediaSource.bitrate == preferences.quality.toInt(),
subtitleTracks = externalSubtitleList,
initialized = true,
)
} else {
val staticUrl = baseUrl.toHttpUrl().newBuilder().apply {
addPathSegment("Videos")
addPathSegment(itemId)
addPathSegment("stream")
addQueryParameter("static", "True")
addQueryParameter("PlaySessionId", sessionData.playSessionId)
}.build().toString()

Video(
videoTitle = "Source - ${videoBitrate}ps",
videoUrl = staticUrl,
bitrate = Int.MAX_VALUE,
headers = videoHeaders,
preferred = mediaSource.bitrate == preferences.quality.toInt(),
subtitleTracks = externalSubtitleList,
initialized = true,
)
}
val staticVideo = Video(
videoTitle = "Source - ${videoBitrate}ps",
videoUrl = staticUrl,
bitrate = Int.MAX_VALUE,
headers = videoHeaders,
preferred = mediaSource.bitrate == preferences.quality.toInt(),
subtitleTracks = externalSubtitleList,
initialized = true,
)

val sessionMediaSource = sessionData.mediaSources.firstOrNull()
?: return emptyList()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ data class MediaDto(
val transcodingUrl: String? = null,
val isRemote: Boolean = false,
val path: String? = null,
val name: String? = null,
val supportsTranscoding: Boolean,
val supportsDirectStream: Boolean,
val mediaStreams: List<MediaStreamDto>,
Expand Down
Loading