Skip to content

Commit c804b6c

Browse files
authored
Merge pull request #24 from RomaP13/feat/custom-quality-handling
feat: add support for stream quality configuration via config file
2 parents 9040c12 + 35bd29c commit c804b6c

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

mov_cli_youtube/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@
2222
}
2323
}
2424

25-
__version__ = "1.3.5"
25+
__version__ = "1.3.6"

mov_cli_youtube/yt_dlp.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919

2020
import yt_dlp
2121

22+
from mov_cli import ExtraMetadata, Metadata, MetadataType, Quality, Single
2223
from mov_cli.scraper import Scraper
2324
from mov_cli.utils import EpisodeSelector
24-
from mov_cli import Single, Metadata, MetadataType, ExtraMetadata
2525

2626
__all__ = ("YTDlpScraper",)
2727

@@ -127,6 +127,14 @@ def __get_best_stream(self, ytdlp_info: dict, video: bool = False, audio: bool =
127127
if ensure_correct_audio_localisation and not stream_format["language"] == self.config.language.iso639_1:
128128
continue
129129

130+
if (
131+
# Only filter when not "auto"
132+
self.config.resolution != Quality.AUTO
133+
and stream_format.get("height")
134+
and stream_format["height"] > self.config.resolution.value
135+
):
136+
continue
137+
130138
url: str = stream_format["url"]
131139
quality: int = stream_format["quality"]
132140

0 commit comments

Comments
 (0)