diff options
Diffstat (limited to 'settings.py')
-rw-r--r-- | settings.py | 56 |
1 files changed, 48 insertions, 8 deletions
diff --git a/settings.py b/settings.py index fdaebc7..d222aa9 100644 --- a/settings.py +++ b/settings.py @@ -168,14 +168,34 @@ For security reasons, enabling this is not recommended.''', 'category': 'playback', }), - ('preferred_video_codec', { + ('codec_rank_h264', { 'type': int, - 'default': 0, + 'default': 1, + 'label': 'H.264 Codec Ranking', 'comment': '', - 'options': [ - (0, 'h.264'), - (1, 'AV1'), - ], + 'options': [(1, '#1'), (2, '#2'), (3, '#3')], + 'category': 'playback', + 'description': ( + 'Which video codecs to prefer. Codecs given the same ' + 'ranking will use smaller file size as a tiebreaker.' + ) + }), + + ('codec_rank_vp', { + 'type': int, + 'default': 2, + 'label': 'VP8/VP9 Codec Ranking', + 'comment': '', + 'options': [(1, '#1'), (2, '#2'), (3, '#3')], + 'category': 'playback', + }), + + ('codec_rank_av1', { + 'type': int, + 'default': 3, + 'label': 'AV1 Codec Ranking', + 'comment': '', + 'options': [(1, '#1'), (2, '#2'), (3, '#3')], 'category': 'playback', }), @@ -280,14 +300,16 @@ For security reasons, enabling this is not recommended.''', ('settings_version', { 'type': int, - 'default': 3, + 'default': 4, 'comment': '''Do not change, remove, or comment out this value, or else your settings may be lost or corrupted''', 'hidden': True, }), ]) program_directory = os.path.dirname(os.path.realpath(__file__)) -acceptable_targets = SETTINGS_INFO.keys() | {'enable_comments', 'enable_related_videos'} +acceptable_targets = SETTINGS_INFO.keys() | { + 'enable_comments', 'enable_related_videos', 'preferred_video_codec' +} def comment_string(comment): @@ -334,9 +356,27 @@ def upgrade_to_3(settings_dict): return new_settings +def upgrade_to_4(settings_dict): + new_settings = settings_dict.copy() + if 'preferred_video_codec' in settings_dict: + pref = settings_dict['preferred_video_codec'] + if pref == 0: + new_settings['codec_rank_h264'] = 1 + new_settings['codec_rank_vp'] = 2 + new_settings['codec_rank_av1'] = 3 + else: + new_settings['codec_rank_h264'] = 3 + new_settings['codec_rank_vp'] = 2 + new_settings['codec_rank_av1'] = 1 + del new_settings['preferred_video_codec'] + new_settings['settings_version'] = 4 + return new_settings + + upgrade_functions = { 1: upgrade_to_2, 2: upgrade_to_3, + 3: upgrade_to_4, } |