From 54314fcee1ff8b3a6039129a298417dd0714994c Mon Sep 17 00:00:00 2001 From: deniscerri <64997243+deniscerri@users.noreply.github.com> Date: Sun, 2 Mar 2025 15:10:22 +0100 Subject: [PATCH] add write subs when embed subs enabled toggle --- .../deniscerri/ytdl/util/extractors/YTDLPUtil.kt | 14 ++++++++++---- app/src/main/res/values/strings.xml | 2 ++ app/src/main/res/xml/processing_preferences.xml | 8 ++++++++ 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/deniscerri/ytdl/util/extractors/YTDLPUtil.kt b/app/src/main/java/com/deniscerri/ytdl/util/extractors/YTDLPUtil.kt index 4774bf25..32dc1c04 100644 --- a/app/src/main/java/com/deniscerri/ytdl/util/extractors/YTDLPUtil.kt +++ b/app/src/main/java/com/deniscerri/ytdl/util/extractors/YTDLPUtil.kt @@ -1174,14 +1174,20 @@ class YTDLPUtil(private val context: Context, private val commandTemplateDao: Co request.addOption("--write-subs") } - if (downloadItem.videoPreferences.embedSubs) { - request.addOption("--embed-subs") - } - if(downloadItem.videoPreferences.writeAutoSubs){ request.addOption("--write-auto-subs") } + if (downloadItem.videoPreferences.embedSubs) { + if (sharedPreferences.getBoolean("write_subs_when_embed_subs", false) && !downloadItem.videoPreferences.writeSubs && !downloadItem.videoPreferences.writeAutoSubs) { + request.addOption("--write-subs") + request.addOption("--write-auto-subs") + request.addOption("--compat-options", "no-keep-subs") + } + + request.addOption("--embed-subs") + } + if (downloadItem.videoPreferences.embedSubs || downloadItem.videoPreferences.writeSubs || downloadItem.videoPreferences.writeAutoSubs){ val subFormat = sharedPreferences.getString("sub_format", "srt") if(subFormat!!.isNotBlank()){ diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index cd46f915..65cd6835 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -470,4 +470,6 @@ Automatic backup Backup Path Automatically make a backup of everything when a new version the application is found + Write subtitles when embedding + This will apply Save Subtitles and Save Automatic Subtitles to download the sub files and then delete them after embedding \ No newline at end of file diff --git a/app/src/main/res/xml/processing_preferences.xml b/app/src/main/res/xml/processing_preferences.xml index 2e095c1d..098e186f 100644 --- a/app/src/main/res/xml/processing_preferences.xml +++ b/app/src/main/res/xml/processing_preferences.xml @@ -185,6 +185,14 @@ app:summary="@string/save_subs_desc" app:title="@string/save_auto_subs" /> + +