From 76dc54fc13ba8d4824d4c1ed2852fafdd3689474 Mon Sep 17 00:00:00 2001 From: rlaphoenix Date: Fri, 1 Mar 2024 05:17:59 +0000 Subject: [PATCH] fix(dl): Have --sub-format default to None to keep original sub format --- CONFIG.md | 2 +- devine/commands/dl.py | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/CONFIG.md b/CONFIG.md index 1cc0a6b..46f51ee 100644 --- a/CONFIG.md +++ b/CONFIG.md @@ -160,7 +160,7 @@ AMZN: 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 sub_format: vtt diff --git a/devine/commands/dl.py b/devine/commands/dl.py index 0e6e547..6ffc235 100644 --- a/devine/commands/dl.py +++ b/devine/commands/dl.py @@ -102,7 +102,7 @@ class dl: @click.option("--tag", type=str, default=None, 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), - default=Subtitle.Codec.SubRip, + default=None, help="Set Output Subtitle Format, only converting if necessary.") @click.option("-V", "--video-only", is_flag=True, default=False, help="Only download video tracks.") @@ -262,7 +262,7 @@ class dl: lang: list[str], v_lang: list[str], s_lang: list[str], - sub_format: Subtitle.Codec, + sub_format: Optional[Subtitle.Codec], video_only: bool, audio_only: bool, subs_only: bool, @@ -572,10 +572,11 @@ class dl: break video_track_n += 1 - with console.status(f"Converting Subtitles to {sub_format.name}..."): - for subtitle in title.tracks.subtitles: - if subtitle.codec != sub_format: - subtitle.convert(sub_format) + if sub_format: + with console.status(f"Converting Subtitles to {sub_format.name}..."): + for subtitle in title.tracks.subtitles: + if subtitle.codec != sub_format: + subtitle.convert(sub_format) with console.status("Repackaging tracks with FFMPEG..."): has_repacked = False