mirror of
https://github.com/unshackle-dl/unshackle.git
synced 2026-03-16 16:19:14 +00:00
feat(dl): add --no-video flag to skip video track downloads
Add new -nv/--no-video CLI flag that allows users to download audio, subtitles, attachments, and chapters without downloading video tracks. Fixes #39
This commit is contained in:
@@ -346,6 +346,7 @@ class dl:
|
|||||||
@click.option("-ns", "--no-subs", is_flag=True, default=False, help="Do not download subtitle tracks.")
|
@click.option("-ns", "--no-subs", is_flag=True, default=False, help="Do not download subtitle tracks.")
|
||||||
@click.option("-na", "--no-audio", is_flag=True, default=False, help="Do not download audio tracks.")
|
@click.option("-na", "--no-audio", is_flag=True, default=False, help="Do not download audio tracks.")
|
||||||
@click.option("-nc", "--no-chapters", is_flag=True, default=False, help="Do not download chapters tracks.")
|
@click.option("-nc", "--no-chapters", is_flag=True, default=False, help="Do not download chapters tracks.")
|
||||||
|
@click.option("-nv", "--no-video", is_flag=True, default=False, help="Do not download video tracks.")
|
||||||
@click.option("-ad", "--audio-description", is_flag=True, default=False, help="Download audio description tracks.")
|
@click.option("-ad", "--audio-description", is_flag=True, default=False, help="Download audio description tracks.")
|
||||||
@click.option(
|
@click.option(
|
||||||
"--slow",
|
"--slow",
|
||||||
@@ -740,6 +741,7 @@ class dl:
|
|||||||
no_subs: bool,
|
no_subs: bool,
|
||||||
no_audio: bool,
|
no_audio: bool,
|
||||||
no_chapters: bool,
|
no_chapters: bool,
|
||||||
|
no_video: bool,
|
||||||
audio_description: bool,
|
audio_description: bool,
|
||||||
slow: bool,
|
slow: bool,
|
||||||
list_: bool,
|
list_: bool,
|
||||||
@@ -982,6 +984,11 @@ class dl:
|
|||||||
s_lang = None
|
s_lang = None
|
||||||
title.tracks.subtitles = []
|
title.tracks.subtitles = []
|
||||||
|
|
||||||
|
if no_video:
|
||||||
|
console.log("Skipped video as --no-video was used...")
|
||||||
|
v_lang = None
|
||||||
|
title.tracks.videos = []
|
||||||
|
|
||||||
with console.status("Getting tracks...", spinner="dots"):
|
with console.status("Getting tracks...", spinner="dots"):
|
||||||
try:
|
try:
|
||||||
title.tracks.add(service.get_tracks(title), warn_only=True)
|
title.tracks.add(service.get_tracks(title), warn_only=True)
|
||||||
@@ -1322,7 +1329,7 @@ class dl:
|
|||||||
self.log.error(f"There's no {processed_lang} Audio Track, cannot continue...")
|
self.log.error(f"There's no {processed_lang} Audio Track, cannot continue...")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
if video_only or audio_only or subs_only or chapters_only or no_subs or no_audio or no_chapters:
|
if video_only or audio_only or subs_only or chapters_only or no_subs or no_audio or no_chapters or no_video:
|
||||||
keep_videos = False
|
keep_videos = False
|
||||||
keep_audio = False
|
keep_audio = False
|
||||||
keep_subtitles = False
|
keep_subtitles = False
|
||||||
@@ -1349,6 +1356,8 @@ class dl:
|
|||||||
keep_audio = False
|
keep_audio = False
|
||||||
if no_chapters:
|
if no_chapters:
|
||||||
keep_chapters = False
|
keep_chapters = False
|
||||||
|
if no_video:
|
||||||
|
keep_videos = False
|
||||||
|
|
||||||
kept_tracks = []
|
kept_tracks = []
|
||||||
if keep_videos:
|
if keep_videos:
|
||||||
@@ -1505,6 +1514,7 @@ class dl:
|
|||||||
and not no_subs
|
and not no_subs
|
||||||
and not (hasattr(service, "NO_SUBTITLES") and service.NO_SUBTITLES)
|
and not (hasattr(service, "NO_SUBTITLES") and service.NO_SUBTITLES)
|
||||||
and not video_only
|
and not video_only
|
||||||
|
and not no_video
|
||||||
and len(title.tracks.videos) > video_track_n
|
and len(title.tracks.videos) > video_track_n
|
||||||
and any(
|
and any(
|
||||||
x.get("codec_name", "").startswith("eia_")
|
x.get("codec_name", "").startswith("eia_")
|
||||||
|
|||||||
Reference in New Issue
Block a user