aboutsummaryrefslogtreecommitdiffstats
path: root/youtube/watch.py
diff options
context:
space:
mode:
authorAstound <kirito@disroot.org>2024-01-22 06:33:34 +0800
committerAstound <kirito@disroot.org>2024-01-22 06:33:34 +0800
commit6ae20bb1f5edb99dc7739d3182713968380cd9c2 (patch)
treec15d1424096b20db98848b4fe0646dac8b6b70cf /youtube/watch.py
parent5f3b90ad45993f99bf2813ef2fefaa3a59a2694f (diff)
downloadyt-local-6ae20bb1f5edb99dc7739d3182713968380cd9c2.tar.lz
yt-local-6ae20bb1f5edb99dc7739d3182713968380cd9c2.tar.xz
yt-local-6ae20bb1f5edb99dc7739d3182713968380cd9c2.zip
Add option to always use integrated sources
Make the prefer_integrated_sources setting an int with 0,1,2 instead of a bool, where 2 makes it always use integrated sources unless none are available.
Diffstat (limited to 'youtube/watch.py')
-rw-r--r--youtube/watch.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/youtube/watch.py b/youtube/watch.py
index 0d03250..ceb66ea 100644
--- a/youtube/watch.py
+++ b/youtube/watch.py
@@ -705,9 +705,17 @@ def get_watch_page(video_id=None):
else:
closer_to_target = 'pair'
- using_pair_sources = (
- bool(pair_sources) and (not uni_sources or closer_to_target == 'pair')
- )
+ if settings.prefer_uni_sources == 2:
+ # Use uni sources unless there's no choice.
+ using_pair_sources = (
+ bool(pair_sources) and (not uni_sources)
+ )
+ else:
+ # Use the pair sources if they're closer to the desired resolution
+ using_pair_sources = (
+ bool(pair_sources)
+ and (not uni_sources or closer_to_target == 'pair')
+ )
if using_pair_sources:
video_height = pair_sources[pair_idx]['height']
video_width = pair_sources[pair_idx]['width']