1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2025-11-08 10:35:12 +00:00

Add compat-option no-keep-subs

Closes #630
This commit is contained in:
pukkandan
2021-08-05 23:30:53 +05:30
parent fee5f0c909
commit b51d2ae3ca
3 changed files with 5 additions and 4 deletions

View File

@@ -404,7 +404,7 @@ class YoutubeDL(object):
compat_opts: Compatibility options. See "Differences in default behavior".
The following options do not work when used through the API:
filename, abort-on-error, multistreams, no-live-chat,
no-clean-infojson, no-playlist-metafiles.
no-clean-infojson, no-playlist-metafiles, no-keep-subs.
Refer __init__.py for their implementation
The following parameters are not used by YoutubeDL itself, they are used by

View File

@@ -280,7 +280,7 @@ def _real_main(argv=None):
'filename', 'format-sort', 'abort-on-error', 'format-spec', 'no-playlist-metafiles',
'multistreams', 'no-live-chat', 'playlist-index', 'list-formats', 'no-direct-merge',
'no-youtube-channel-redirect', 'no-youtube-unavailable-videos', 'no-attach-info-json',
'embed-thumbnail-atomicparsley', 'seperate-video-versions', 'no-clean-infojson',
'embed-thumbnail-atomicparsley', 'seperate-video-versions', 'no-clean-infojson', 'no-keep-subs',
]
compat_opts = parse_compat_opts()
@@ -458,13 +458,13 @@ def _real_main(argv=None):
if opts.addmetadata:
postprocessors.append({'key': 'FFmpegMetadata'})
if opts.embedsubtitles:
already_have_subtitle = opts.writesubtitles
already_have_subtitle = opts.writesubtitles and 'no-keep-subs' not in compat_opts
postprocessors.append({
'key': 'FFmpegEmbedSubtitle',
# already_have_subtitle = True prevents the file from being deleted after embedding
'already_have_subtitle': already_have_subtitle
})
if not already_have_subtitle:
if not opts.writeautomaticsub and 'no-keep-subs' not in compat_opts:
opts.writesubtitles = True
# --all-sub automatically sets --write-sub if --write-auto-sub is not given
# this was the old behaviour if only --all-sub was given.