feat(dl): Change --vcodec default to None, use any codec

This commit is contained in:
rlaphoenix 2024-03-04 10:41:07 +00:00
parent 1adc551926
commit b7b88f66ce
1 changed files with 8 additions and 7 deletions

View File

@ -70,8 +70,8 @@ class dl:
@click.option("-q", "--quality", type=QUALITY_LIST, default=[], @click.option("-q", "--quality", type=QUALITY_LIST, default=[],
help="Download Resolution(s), defaults to the best available resolution.") help="Download Resolution(s), defaults to the best available resolution.")
@click.option("-v", "--vcodec", type=click.Choice(Video.Codec, case_sensitive=False), @click.option("-v", "--vcodec", type=click.Choice(Video.Codec, case_sensitive=False),
default=Video.Codec.AVC, default=None,
help="Video Codec to download, defaults to H.264.") help="Video Codec to download, defaults to any codec.")
@click.option("-a", "--acodec", type=click.Choice(Audio.Codec, case_sensitive=False), @click.option("-a", "--acodec", type=click.Choice(Audio.Codec, case_sensitive=False),
default=None, default=None,
help="Audio Codec to download, defaults to any codec.") help="Audio Codec to download, defaults to any codec.")
@ -250,7 +250,7 @@ class dl:
self, self,
service: Service, service: Service,
quality: list[int], quality: list[int],
vcodec: Video.Codec, vcodec: Optional[Video.Codec],
acodec: Optional[Audio.Codec], acodec: Optional[Audio.Codec],
vbitrate: int, vbitrate: int,
abitrate: int, abitrate: int,
@ -357,10 +357,11 @@ class dl:
with console.status("Selecting tracks...", spinner="dots"): with console.status("Selecting tracks...", spinner="dots"):
if isinstance(title, (Movie, Episode)): if isinstance(title, (Movie, Episode)):
# filter video tracks # filter video tracks
title.tracks.select_video(lambda x: x.codec == vcodec) if vcodec:
if not title.tracks.videos: title.tracks.select_video(lambda x: x.codec == vcodec)
self.log.error(f"There's no {vcodec.name} Video Track...") if not title.tracks.videos:
sys.exit(1) self.log.error(f"There's no {vcodec.name} Video Track...")
sys.exit(1)
title.tracks.select_video(lambda x: x.range == range_) title.tracks.select_video(lambda x: x.range == range_)
if not title.tracks.videos: if not title.tracks.videos: