Skip to content

Commit

Permalink
fix(format): videos are remuxed to mkv when download subtitle is disa…
Browse files Browse the repository at this point in the history
…bled
  • Loading branch information
JunkFood02 committed Apr 7, 2024
1 parent e016faa commit dfb824a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ import com.junkfood.seal.util.PreferenceUtil.updateBoolean
import com.junkfood.seal.util.PreferenceUtil.updateInt
import com.junkfood.seal.util.PreferenceUtil.updateString
import com.junkfood.seal.util.SORTING_FIELDS
import com.junkfood.seal.util.SUBTITLE
import com.junkfood.seal.util.VIDEO_CLIP
import com.junkfood.seal.util.VIDEO_FORMAT
import com.junkfood.seal.util.VIDEO_QUALITY
Expand All @@ -81,6 +82,7 @@ fun DownloadFormatPreferences(onNavigateBack: () -> Unit, navigateToSubtitlePage
var isArtworkCroppingEnabled by remember {
mutableStateOf(PreferenceUtil.getValue(CROP_ARTWORK))
}
val downloadSubtitle by SUBTITLE.booleanState
val embedSubtitle by EMBED_SUBTITLE.booleanState
var remuxToMkv by MERGE_OUTPUT_MKV.booleanState
var embedMetadata by EMBED_METADATA.booleanState
Expand Down Expand Up @@ -240,16 +242,16 @@ fun DownloadFormatPreferences(onNavigateBack: () -> Unit, navigateToSubtitlePage
description = stringResource(
id = R.string.remux_container_mkv_desc
),
isChecked = embedSubtitle || remuxToMkv,
isChecked = (downloadSubtitle && embedSubtitle) || remuxToMkv,
icon = Icons.Outlined.Movie,
enabled = !embedSubtitle && !isCustomCommandEnabled && !audioSwitch,
enabled = !(downloadSubtitle && embedSubtitle) && !isCustomCommandEnabled && !audioSwitch,
onClick = {
remuxToMkv = !remuxToMkv
MERGE_OUTPUT_MKV.updateBoolean(remuxToMkv)
},
)
}
if (embedSubtitle) {
if (downloadSubtitle && embedSubtitle) {
item {
PreferenceInfo(text = stringResource(id = R.string.embed_subtitles_mkv_msg))
}
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/com/junkfood/seal/util/DownloadUtil.kt
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ object DownloadUtil {
val supportAv1HardwareDecoding: Boolean = checkIfAv1HardwareAccelerated(),
val forceIpv4: Boolean = FORCE_IPV4.getBoolean(),
val mergeAudioStream: Boolean = false,
val mergeToMkv: Boolean = embedSubtitle || MERGE_OUTPUT_MKV.getBoolean()
val mergeToMkv: Boolean = (downloadSubtitle && embedSubtitle) || MERGE_OUTPUT_MKV.getBoolean()
)

private fun YoutubeDLRequest.enableCookies(userAgentString: String): YoutubeDLRequest =
Expand Down

0 comments on commit dfb824a

Please sign in to comment.