Fix linting for JellyfinRepositoryImpl

This commit is contained in:
Efflam 2023-02-13 10:02:49 +01:00 committed by Sean Greenawalt
parent b7b92b9df5
commit d80568baa5

View file

@ -31,7 +31,6 @@ import io.ktor.utils.io.ByteReadChannel
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.withContext import kotlinx.coroutines.withContext
import org.jellyfin.sdk.api.client.exception.InvalidStatusException
import org.jellyfin.sdk.api.client.extensions.dynamicHlsApi import org.jellyfin.sdk.api.client.extensions.dynamicHlsApi
import org.jellyfin.sdk.api.client.extensions.get import org.jellyfin.sdk.api.client.extensions.get
import org.jellyfin.sdk.model.api.BaseItemDto import org.jellyfin.sdk.model.api.BaseItemDto
@ -358,10 +357,9 @@ class JellyfinRepositoryImpl(
return when (transcodeResolution) { return when (transcodeResolution) {
2160 -> 59616000 to 384000 2160 -> 59616000 to 384000
1080 -> 14616000 to 384000 1080 -> 14616000 to 384000
720 -> 7616000 to 384000 720 -> 7616000 to 384000
480 -> 2616000 to 384000 480 -> 2616000 to 384000
360 -> 292000 to 128000 360 -> 292000 to 128000
else -> null to null else -> null to null
} }
} }
@ -374,15 +372,14 @@ class JellyfinRepositoryImpl(
withContext(Dispatchers.IO) { withContext(Dispatchers.IO) {
try { try {
val (videoBitRate, audioBitRate) = getVideoTranscodeBitRate(transcodeResolution) val (videoBitRate, audioBitRate) = getVideoTranscodeBitRate(transcodeResolution)
if(videoBitRate == null || audioBitRate == null) { if (videoBitRate == null || audioBitRate == null) {
jellyfinApi.api.dynamicHlsApi.getVariantHlsVideoPlaylistUrl( jellyfinApi.api.dynamicHlsApi.getVariantHlsVideoPlaylistUrl(
itemId, itemId,
static = true, static = true,
mediaSourceId = mediaSourceId, mediaSourceId = mediaSourceId,
playSessionId = playSessionIds[itemId] // playSessionId is required to update the transcoding resolution playSessionId = playSessionIds[itemId] // playSessionId is required to update the transcoding resolution
) )
} } else {
else {
jellyfinApi.api.dynamicHlsApi.getVariantHlsVideoPlaylistUrl( jellyfinApi.api.dynamicHlsApi.getVariantHlsVideoPlaylistUrl(
itemId, itemId,
static = false, static = false,