fix(dl): Have --sub-format default to None to keep original sub format

This commit is contained in:
rlaphoenix 2024-03-01 05:17:59 +00:00
parent c516f54a07
commit 76dc54fc13
2 changed files with 8 additions and 7 deletions

View File

@ -160,7 +160,7 @@ AMZN:
bitrate: CVBR bitrate: CVBR
``` ```
or to change the output subtitle format from the default (SubRip SRT) to WebVTT, or to change the output subtitle format from the default (original format) to WebVTT,
```yaml ```yaml
sub_format: vtt sub_format: vtt

View File

@ -102,7 +102,7 @@ class dl:
@click.option("--tag", type=str, default=None, @click.option("--tag", type=str, default=None,
help="Set the Group Tag to be used, overriding the one in config if any.") help="Set the Group Tag to be used, overriding the one in config if any.")
@click.option("--sub-format", type=click.Choice(Subtitle.Codec, case_sensitive=False), @click.option("--sub-format", type=click.Choice(Subtitle.Codec, case_sensitive=False),
default=Subtitle.Codec.SubRip, default=None,
help="Set Output Subtitle Format, only converting if necessary.") help="Set Output Subtitle Format, only converting if necessary.")
@click.option("-V", "--video-only", is_flag=True, default=False, @click.option("-V", "--video-only", is_flag=True, default=False,
help="Only download video tracks.") help="Only download video tracks.")
@ -262,7 +262,7 @@ class dl:
lang: list[str], lang: list[str],
v_lang: list[str], v_lang: list[str],
s_lang: list[str], s_lang: list[str],
sub_format: Subtitle.Codec, sub_format: Optional[Subtitle.Codec],
video_only: bool, video_only: bool,
audio_only: bool, audio_only: bool,
subs_only: bool, subs_only: bool,
@ -572,6 +572,7 @@ class dl:
break break
video_track_n += 1 video_track_n += 1
if sub_format:
with console.status(f"Converting Subtitles to {sub_format.name}..."): with console.status(f"Converting Subtitles to {sub_format.name}..."):
for subtitle in title.tracks.subtitles: for subtitle in title.tracks.subtitles:
if subtitle.codec != sub_format: if subtitle.codec != sub_format: