add write subs when embed subs enabled toggle
This commit is contained in:
parent
8147dd88d7
commit
54314fcee1
3 changed files with 20 additions and 4 deletions
|
|
@ -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()){
|
||||
|
|
|
|||
|
|
@ -470,4 +470,6 @@
|
|||
<string name="automatic_backup">Automatic backup</string>
|
||||
<string name="backup_path">Backup Path</string>
|
||||
<string name="automatic_backup_summary">Automatically make a backup of everything when a new version the application is found</string>
|
||||
<string name="write_subs_when_embed_subs">Write subtitles when embedding</string>
|
||||
<string name="write_subs_when_embed_subs_summary">This will apply Save Subtitles and Save Automatic Subtitles to download the sub files and then delete them after embedding</string>
|
||||
</resources>
|
||||
|
|
@ -185,6 +185,14 @@
|
|||
app:summary="@string/save_subs_desc"
|
||||
app:title="@string/save_auto_subs" />
|
||||
|
||||
<SwitchPreferenceCompat
|
||||
android:widgetLayout="@layout/preferece_material_switch"
|
||||
app:defaultValue="true"
|
||||
app:icon="@drawable/ic_subtitles"
|
||||
app:key="write_subs_when_embed_subs"
|
||||
app:summary="@string/write_subs_when_embed_subs_summary"
|
||||
app:title="@string/write_subs_when_embed_subs" />
|
||||
|
||||
<Preference
|
||||
android:icon="@drawable/baseline_subject_24"
|
||||
app:key="subs_lang"
|
||||
|
|
|
|||
Loading…
Reference in a new issue