Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_upgrade_to_v1_0_0_final_0_A(self):
TextOption('setting', 'file_naming_format', '')
self.config.setting['va_file_naming_format'] = 'abc'
self.config.setting['use_va_format'] = True
self.assertIn('va_file_naming_format', self.config.setting)
self.assertIn('use_va_format', self.config.setting)
upgrade_to_v1_0_0_final_0(self.config, interactive=False, merge=True)
self.assertNotIn('va_file_naming_format', self.config.setting)
self.assertNotIn('use_va_format', self.config.setting)
self.assertIn('file_naming_format', self.config.setting)
def test_text_opt_set_empty(self):
TextOption("setting", "text_option", "abc")
# set option to ""
self.config.setting["text_option"] = ""
self.assertEqual(self.config.setting["text_option"], "")
register_options_page,
)
from picard.ui.ui_options_fingerprinting import Ui_FingerprintingOptionsPage
class FingerprintingOptionsPage(OptionsPage):
NAME = "fingerprinting"
TITLE = N_("Fingerprinting")
PARENT = None
SORT_ORDER = 45
ACTIVE = True
options = [
config.BoolOption("setting", "ignore_existing_acoustid_fingerprints", False),
config.TextOption("setting", "fingerprinting_system", "acoustid"),
config.TextOption("setting", "acoustid_fpcalc", ""),
config.TextOption("setting", "acoustid_apikey", ""),
]
def __init__(self, parent=None):
super().__init__(parent)
self._fpcalc_valid = True
self.ui = Ui_FingerprintingOptionsPage()
self.ui.setupUi(self)
self.ui.disable_fingerprinting.clicked.connect(self.update_groupboxes)
self.ui.use_acoustid.clicked.connect(self.update_groupboxes)
self.ui.acoustid_fpcalc.textChanged.connect(self._acoustid_fpcalc_check)
self.ui.acoustid_fpcalc_browse.clicked.connect(self.acoustid_fpcalc_browse)
self.ui.acoustid_fpcalc_download.clicked.connect(self.acoustid_fpcalc_download)
self.ui.acoustid_apikey_get.clicked.connect(self.acoustid_apikey_get)
options = [
config.IntOption("setting", "format_group_additional", 3),
config.IntOption("setting", "format_group_guest", 4),
config.IntOption("setting", "format_group_solo", 3),
config.IntOption("setting", "format_group_vocals", 2),
config.TextOption("setting", "format_group_1_start_char", ''),
config.TextOption("setting", "format_group_1_end_char", ' '),
config.TextOption("setting", "format_group_1_sep_char", ''),
config.TextOption("setting", "format_group_2_start_char", ', '),
config.TextOption("setting", "format_group_2_end_char", ''),
config.TextOption("setting", "format_group_2_sep_char", ''),
config.TextOption("setting", "format_group_3_start_char", ' ('),
config.TextOption("setting", "format_group_3_end_char", ')'),
config.TextOption("setting", "format_group_3_sep_char", ''),
config.TextOption("setting", "format_group_4_start_char", ' ('),
config.TextOption("setting", "format_group_4_end_char", ')'),
config.TextOption("setting", "format_group_4_sep_char", ''),
]
def __init__(self, parent=None):
super(FormatPerformerTagsOptionsPage, self).__init__(parent)
self.ui = Ui_FormatPerformerTagsOptionsPage()
self.ui.setupUi(self)
self.ui.additional_rb_1.clicked.connect(self.update_examples)
self.ui.additional_rb_2.clicked.connect(self.update_examples)
self.ui.additional_rb_3.clicked.connect(self.update_examples)
self.ui.additional_rb_4.clicked.connect(self.update_examples)
self.ui.guest_rb_1.clicked.connect(self.update_examples)
self.ui.guest_rb_2.clicked.connect(self.update_examples)
self.ui.guest_rb_3.clicked.connect(self.update_examples)
self.ui.guest_rb_4.clicked.connect(self.update_examples)
)
from picard.ui.ui_options_fingerprinting import Ui_FingerprintingOptionsPage
class FingerprintingOptionsPage(OptionsPage):
NAME = "fingerprinting"
TITLE = N_("Fingerprinting")
PARENT = None
SORT_ORDER = 45
ACTIVE = True
options = [
config.BoolOption("setting", "ignore_existing_acoustid_fingerprints", False),
config.TextOption("setting", "fingerprinting_system", "acoustid"),
config.TextOption("setting", "acoustid_fpcalc", ""),
config.TextOption("setting", "acoustid_apikey", ""),
]
def __init__(self, parent=None):
super().__init__(parent)
self._fpcalc_valid = True
self.ui = Ui_FingerprintingOptionsPage()
self.ui.setupUi(self)
self.ui.disable_fingerprinting.clicked.connect(self.update_groupboxes)
self.ui.use_acoustid.clicked.connect(self.update_groupboxes)
self.ui.acoustid_fpcalc.textChanged.connect(self._acoustid_fpcalc_check)
self.ui.acoustid_fpcalc_browse.clicked.connect(self.acoustid_fpcalc_browse)
self.ui.acoustid_fpcalc_download.clicked.connect(self.acoustid_fpcalc_download)
self.ui.acoustid_apikey_get.clicked.connect(self.acoustid_apikey_get)
def load(self):
BoolOption("setting", "lastfm_use_city_tag", True),
BoolOption("setting", "lastfm_use_decade_tag", True),
BoolOption("setting", "lastfm_use_year_tag", True),
TextOption("setting", "lastfm_join_tags_sign", "; "),
BoolOption("setting", "lastfm_app_major2minor_tag", True),
BoolOption("setting", "lastfm_use_track_tags", True),
IntOption("setting", "lastfm_min_tracktag_weight", 5),
IntOption("setting", "lastfm_max_tracktag_drop", 90),
BoolOption("setting", "lastfm_artist_tag_us_no", False),
BoolOption("setting", "lastfm_artist_tag_us_ex", True),
BoolOption("setting", "lastfm_artist_tag_us_yes", False),
IntOption("setting", "lastfm_artist_tags_weight", 95),
IntOption("setting", "lastfm_min_artisttag_weight", 10),
IntOption("setting", "lastfm_max_artisttag_drop", 80),
TextOption("setting", "lastfm_genre_major", ",".join(GENRE_FILTER["major"]).lower()),
TextOption("setting", "lastfm_genre_minor", ",".join(GENRE_FILTER["minor"]).lower()),
TextOption("setting", "lastfm_genre_decade",", ".join(GENRE_FILTER["decade"]).lower()),
TextOption("setting", "lastfm_genre_year",", ".join(GENRE_FILTER["year"]).lower()),
TextOption("setting", "lastfm_genre_occasion",", ".join(GENRE_FILTER["occasion"]).lower()),
TextOption("setting", "lastfm_genre_category",", ".join(GENRE_FILTER["category"]).lower()),
TextOption("setting", "lastfm_genre_country",", ".join(GENRE_FILTER["country"]).lower()),
TextOption("setting", "lastfm_genre_city",", ".join(GENRE_FILTER["city"]).lower()),
TextOption("setting", "lastfm_genre_mood", ",".join(GENRE_FILTER["mood"]).lower()),
TextOption("setting", "lastfm_genre_translations", "\n".join(["%s,%s" % (k,v) for k, v in GENRE_FILTER["translate"].items()]).lower())
]
def __init__(self, parent=None):
super(LastfmOptionsPage, self).__init__(parent)
self.ui = Ui_LastfmOptionsPage()
self.ui.setupUi(self)
# TODO Not yet implemented properly
# self.connect(self.ui.check_translation_list, QtCore.SIGNAL("clicked()"), self.check_translations)
self.tagger.window.set_statusbar_message(
N_('Could not calculate album gain for "%(album)s".'),
{'album': album.metadata["album"]}
)
class ReplayGainOptionsPage(OptionsPage):
NAME = "replaygain"
TITLE = "ReplayGain"
PARENT = "plugins"
options = [
TextOption("setting", "replaygain_vorbisgain_command", "vorbisgain"),
TextOption("setting", "replaygain_vorbisgain_options", "-asf"),
TextOption("setting", "replaygain_mp3gain_command", "mp3gain"),
TextOption("setting", "replaygain_mp3gain_options", "-a -s i"),
TextOption("setting", "replaygain_metaflac_command", "metaflac"),
TextOption("setting", "replaygain_metaflac_options", "--add-replay-gain"),
TextOption("setting", "replaygain_wvgain_command", "wvgain"),
TextOption("setting", "replaygain_wvgain_options", "-a")
]
def __init__(self, parent=None):
super(ReplayGainOptionsPage, self).__init__(parent)
self.ui = Ui_ReplayGainOptionsPage()
self.ui.setupUi(self)
def load(self):
self.ui.vorbisgain_command.setText(self.config.setting["replaygain_vorbisgain_command"])
self.ui.mp3gain_command.setText(self.config.setting["replaygain_mp3gain_command"])
self.ui.metaflac_command.setText(self.config.setting["replaygain_metaflac_command"])
self.ui.wvgain_command.setText(self.config.setting["replaygain_wvgain_command"])
)
class MoodbarOptionsPage(OptionsPage):
NAME = "Moodbars"
TITLE = "Moodbars"
PARENT = "plugins"
options = [
TextOption("setting", "moodbar_vorbis_command", "moodbar"),
TextOption("setting", "moodbar_vorbis_options", "-o"),
TextOption("setting", "moodbar_mp3_command", "moodbar"),
TextOption("setting", "moodbar_mp3_options", "-o"),
TextOption("setting", "moodbar_flac_command", "moodbar"),
TextOption("setting", "moodbar_flac_options", "-o"),
TextOption("setting", "moodbar_wav_command", "moodbar"),
TextOption("setting", "moodbar_wav_options", "-o")
]
def __init__(self, parent=None):
super(MoodbarOptionsPage, self).__init__(parent)
self.ui = Ui_MoodbarOptionsPage()
self.ui.setupUi(self)
def load(self):
self.ui.vorbis_command.setText(
self.config.setting["moodbar_vorbis_command"])
self.ui.mp3_command.setText(
self.config.setting["moodbar_mp3_command"])
self.ui.flac_command.setText(
self.config.setting["moodbar_flac_command"])
class FormatPerformerTagsOptionsPage(OptionsPage):
NAME = "format_performer_tags"
TITLE = "Format Performer Tags"
PARENT = "plugins"
options = [
config.IntOption("setting", "format_group_additional", 3),
config.IntOption("setting", "format_group_guest", 4),
config.IntOption("setting", "format_group_solo", 3),
config.IntOption("setting", "format_group_vocals", 2),
config.TextOption("setting", "format_group_1_start_char", ''),
config.TextOption("setting", "format_group_1_end_char", ' '),
config.TextOption("setting", "format_group_1_sep_char", ''),
config.TextOption("setting", "format_group_2_start_char", ', '),
config.TextOption("setting", "format_group_2_end_char", ''),
config.TextOption("setting", "format_group_2_sep_char", ''),
config.TextOption("setting", "format_group_3_start_char", ' ('),
config.TextOption("setting", "format_group_3_end_char", ')'),
config.TextOption("setting", "format_group_3_sep_char", ''),
config.TextOption("setting", "format_group_4_start_char", ' ('),
config.TextOption("setting", "format_group_4_end_char", ')'),
config.TextOption("setting", "format_group_4_sep_char", ''),
]
def __init__(self, parent=None):
super(FormatPerformerTagsOptionsPage, self).__init__(parent)
self.ui = Ui_FormatPerformerTagsOptionsPage()
self.ui.setupUi(self)
self.ui.additional_rb_1.clicked.connect(self.update_examples)
TextOption("setting", "lastfm_join_tags_sign", "; "),
BoolOption("setting", "lastfm_app_major2minor_tag", True),
BoolOption("setting", "lastfm_use_track_tags", True),
IntOption("setting", "lastfm_min_tracktag_weight", 5),
IntOption("setting", "lastfm_max_tracktag_drop", 90),
BoolOption("setting", "lastfm_artist_tag_us_no", False),
BoolOption("setting", "lastfm_artist_tag_us_ex", True),
BoolOption("setting", "lastfm_artist_tag_us_yes", False),
IntOption("setting", "lastfm_artist_tags_weight", 95),
IntOption("setting", "lastfm_min_artisttag_weight", 10),
IntOption("setting", "lastfm_max_artisttag_drop", 80),
TextOption("setting", "lastfm_genre_major", ",".join(GENRE_FILTER["major"]).lower()),
TextOption("setting", "lastfm_genre_minor", ",".join(GENRE_FILTER["minor"]).lower()),
TextOption("setting", "lastfm_genre_decade",", ".join(GENRE_FILTER["decade"]).lower()),
TextOption("setting", "lastfm_genre_year",", ".join(GENRE_FILTER["year"]).lower()),
TextOption("setting", "lastfm_genre_occasion",", ".join(GENRE_FILTER["occasion"]).lower()),
TextOption("setting", "lastfm_genre_category",", ".join(GENRE_FILTER["category"]).lower()),
TextOption("setting", "lastfm_genre_country",", ".join(GENRE_FILTER["country"]).lower()),
TextOption("setting", "lastfm_genre_city",", ".join(GENRE_FILTER["city"]).lower()),
TextOption("setting", "lastfm_genre_mood", ",".join(GENRE_FILTER["mood"]).lower()),
TextOption("setting", "lastfm_genre_translations", "\n".join(["%s,%s" % (k,v) for k, v in GENRE_FILTER["translate"].items()]).lower())
]
def __init__(self, parent=None):
super(LastfmOptionsPage, self).__init__(parent)
self.ui = Ui_LastfmOptionsPage()
self.ui.setupUi(self)
# TODO Not yet implemented properly
# self.connect(self.ui.check_translation_list, QtCore.SIGNAL("clicked()"), self.check_translations)
self.connect(self.ui.check_word_lists,
QtCore.SIGNAL("clicked()"), self.check_words)
self.connect(self.ui.load_default_lists,