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.
This commit is contained in:
parent
5f3b90ad45
commit
6ae20bb1f5
24
settings.py
24
settings.py
@ -200,12 +200,17 @@ For security reasons, enabling this is not recommended.''',
|
||||
}),
|
||||
|
||||
('prefer_uni_sources', {
|
||||
'label': 'Prefer integrated sources',
|
||||
'type': bool,
|
||||
'default': False,
|
||||
'label': 'Use integrated sources',
|
||||
'type': int,
|
||||
'default': 1,
|
||||
'comment': '',
|
||||
'options': [
|
||||
(0, 'Prefer not'),
|
||||
(1, 'Prefer'),
|
||||
(2, 'Always'),
|
||||
],
|
||||
'category': 'playback',
|
||||
'description': 'If enabled and the default resolution is set to 360p or 720p, uses the unified (integrated) video files which contain audio and video, with buffering managed by the browser. If disabled, always uses the separate audio and video files through custom buffer management in av-merge via MediaSource.',
|
||||
'description': 'If set to Prefer or Always and the default resolution is set to 360p or 720p, uses the unified (integrated) video files which contain audio and video, with buffering managed by the browser. If set to prefer not, uses the separate audio and video files through custom buffer management in av-merge via MediaSource unless they are unavailable.',
|
||||
}),
|
||||
|
||||
('use_video_player', {
|
||||
@ -326,7 +331,7 @@ Archive: https://archive.ph/OZQbN''',
|
||||
|
||||
('settings_version', {
|
||||
'type': int,
|
||||
'default': 4,
|
||||
'default': 5,
|
||||
'comment': '''Do not change, remove, or comment out this value, or else your settings may be lost or corrupted''',
|
||||
'hidden': True,
|
||||
}),
|
||||
@ -399,10 +404,19 @@ def upgrade_to_4(settings_dict):
|
||||
return new_settings
|
||||
|
||||
|
||||
def upgrade_to_5(settings_dict):
|
||||
new_settings = settings_dict.copy()
|
||||
if 'prefer_uni_sources' in settings_dict:
|
||||
new_settings['prefer_uni_sources'] = int(settings_dict['prefer_uni_sources'])
|
||||
new_settings['settings_version'] = 5
|
||||
return new_settings
|
||||
|
||||
|
||||
upgrade_functions = {
|
||||
1: upgrade_to_2,
|
||||
2: upgrade_to_3,
|
||||
3: upgrade_to_4,
|
||||
4: upgrade_to_5,
|
||||
}
|
||||
|
||||
|
||||
|
@ -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']
|
||||
|
Loading…
x
Reference in New Issue
Block a user