mirror of
https://github.com/fergalmoran/picard.git
synced 2026-03-01 02:54:01 +00:00
Store cover art providers as a list of tuples
- provide an upgrade function reading old options values
This commit is contained in:
@@ -22,7 +22,7 @@ import re
|
||||
|
||||
PICARD_APP_NAME = "Picard"
|
||||
PICARD_ORG_NAME = "MusicBrainz"
|
||||
PICARD_VERSION = (1, 4, 0, 'dev', 2)
|
||||
PICARD_VERSION = (1, 4, 0, 'dev', 3)
|
||||
|
||||
# optional build version
|
||||
# it should be in the form '<platform>_<YYMMDDHHMMSS>'
|
||||
|
||||
@@ -148,6 +148,22 @@ def upgrade_to_v1_4_0_dev_2():
|
||||
_s.remove(opt)
|
||||
|
||||
|
||||
def upgrade_to_v1_4_0_dev_3():
|
||||
"""Cover art providers options were moved to a list of tuples"""
|
||||
map = [
|
||||
('ca_provider_use_amazon', 'Amazon'),
|
||||
('ca_provider_use_caa', 'Cover Art Archive'),
|
||||
('ca_provider_use_whitelist', 'Whitelist'),
|
||||
('ca_provider_use_caa_release_group_fallback', 'CaaReleaseGroup')
|
||||
]
|
||||
|
||||
newopts = []
|
||||
for old, new in map:
|
||||
if old in _s:
|
||||
newopts.append((new, _s.value(old, config.BoolOption, True)))
|
||||
_s['ca_providers'] = newopts
|
||||
|
||||
|
||||
def upgrade_config():
|
||||
cfg = config._config
|
||||
cfg.register_upgrade_hook(upgrade_to_v1_0_0_final_0)
|
||||
@@ -156,4 +172,5 @@ def upgrade_config():
|
||||
cfg.register_upgrade_hook(upgrade_to_v1_3_0_dev_3)
|
||||
cfg.register_upgrade_hook(upgrade_to_v1_3_0_dev_4)
|
||||
cfg.register_upgrade_hook(upgrade_to_v1_4_0_dev_2)
|
||||
cfg.register_upgrade_hook(upgrade_to_v1_4_0_dev_3)
|
||||
cfg.run_upgrade_hooks(log.debug)
|
||||
|
||||
@@ -129,6 +129,12 @@ class CoverOptionsPage(OptionsPage):
|
||||
config.BoolOption("setting",
|
||||
"ca_provider_use_caa_release_group_fallback", False),
|
||||
config.BoolOption("setting", "ca_provider_use_whitelist", True),
|
||||
config.ListOption("setting", "ca_providers", [
|
||||
('Cover Art Archive', True),
|
||||
('Amazon', True),
|
||||
('Whitelist', True),
|
||||
('CaaReleaseGroup', False),
|
||||
]),
|
||||
config.BoolOption("setting", "caa_approved_only", False),
|
||||
config.BoolOption("setting", "caa_image_type_as_filename", False),
|
||||
config.IntOption("setting", "caa_image_size", 1),
|
||||
|
||||
Reference in New Issue
Block a user