From 29fe188bd062058ba78099f574fd7a50a12f147d Mon Sep 17 00:00:00 2001 From: regorxxx Date: Wed, 25 May 2022 11:43:08 +0200 Subject: [PATCH 1/3] Update AcousticBrainz Tags with configurable tag names. Fix author names to point to email. --- plugins/acousticbrainz/__init__.py | 23 ++++++++++++++----- .../ui_options_acousticbrainz_tags.py | 18 +++++++++++++++ .../ui_options_acousticbrainz_tags.ui | 20 ++++++++++++++++ 3 files changed, 55 insertions(+), 6 deletions(-) diff --git a/plugins/acousticbrainz/__init__.py b/plugins/acousticbrainz/__init__.py index 545940de..d3288122 100644 --- a/plugins/acousticbrainz/__init__.py +++ b/plugins/acousticbrainz/__init__.py @@ -22,9 +22,10 @@ # ============================================================================= PLUGIN_NAME = 'AcousticBrainz Tags' -PLUGIN_AUTHOR = ('Wargreen , ' - 'Hugo Geoffroy "pistache" , ' - 'Philipp Wolfer ') +PLUGIN_AUTHOR = ('Wargreen, ' + 'Hugo Geoffroy "pistache", ' + 'Philipp Wolfer, ' + 'Regorxxx') PLUGIN_DESCRIPTION = ''' Tag files with tags from the AcousticBrainz database, all highlevel classifiers and tonal/rhythm data. @@ -38,7 +39,7 @@ PLUGIN_LICENSE = "GPL-2.0" PLUGIN_LICENSE_URL = "https://www.gnu.org/licenses/gpl-2.0.txt" -PLUGIN_VERSION = "2.2.1" +PLUGIN_VERSION = "2.2.2" PLUGIN_API_VERSIONS = ["2.0", "2.1", "2.2", "2.3", "2.4", "2.5", "2.6", "2.7"] # Plugin configuration @@ -116,7 +117,9 @@ def __init__(self, recording_id, metadata, level, data, files=None): self.data = self._extract_data(data) self.files = files self.do_simplemood = config.setting["acousticbrainz_add_simplemood"] + self.simplemood_tagname = config.setting["acousticbrainz_simplemood_tagname"] self.do_simplegenre = config.setting["acousticbrainz_add_simplegenre"] + self.simplegenre_tagname = config.setting["acousticbrainz_simplegenre_tagname"] self.do_keybpm = config.setting["acousticbrainz_add_keybpm"] self.do_fullhighlevel = config.setting["acousticbrainz_add_fullhighlevel"] self.do_sublowlevel = config.setting["acousticbrainz_add_sublowlevel"] @@ -208,6 +211,7 @@ def update_metadata(self, name, values): def process_simplemood(self): self.debug("processing simplemood data") + mood_tagname = self.simplemood_tagname; moods = [] for classifier, data in self.data.items(): @@ -217,11 +221,12 @@ def process_simplemood(self): if classifier.startswith("mood_") and not inverted: moods.append(value) - self.update_metadata('mood', moods) + self.update_metadata(mood_tagname, moods) def process_simplegenre(self): self.debug("processing simplegenre data") + genre_tagname = self.simplegenre_tagname; genres = [] for classifier, data in self.data.items(): @@ -231,7 +236,7 @@ def process_simplegenre(self): if classifier.startswith("genre_") and not inverted: genres.append(value) - self.update_metadata('genre', genres) + self.update_metadata(genre_tagname, genres) def process_fullhighlevel(self): self.debug("processing fullhighlevel data") @@ -441,7 +446,9 @@ class AcousticBrainzOptionsPage(OptionsPage): options = [ config.BoolOption("setting", "acousticbrainz_add_simplemood", True), + config.TextOption("setting", "acousticbrainz_simplemood_tagname", "ab:mood"), config.BoolOption("setting", "acousticbrainz_add_simplegenre", True), + config.TextOption("setting", "acousticbrainz_simplegenre_tagname", "ab:genre"), config.BoolOption("setting", "acousticbrainz_add_keybpm", False), config.BoolOption("setting", "acousticbrainz_add_fullhighlevel", False), config.BoolOption("setting", "acousticbrainz_add_sublowlevel", False) @@ -455,7 +462,9 @@ def __init__(self, parent=None): def load(self): setting = config.setting self.ui.add_simplemood.setChecked(setting["acousticbrainz_add_simplemood"]) + self.ui.simplemood_tagname.setText(setting["acousticbrainz_simplemood_tagname"]) self.ui.add_simplegenre.setChecked(setting["acousticbrainz_add_simplegenre"]) + self.ui.simplegenre_tagname.setText(setting["acousticbrainz_simplegenre_tagname"]) self.ui.add_fullhighlevel.setChecked(setting["acousticbrainz_add_fullhighlevel"]) self.ui.add_keybpm.setChecked(setting["acousticbrainz_add_keybpm"]) self.ui.add_sublowlevel.setChecked(setting["acousticbrainz_add_sublowlevel"]) @@ -463,7 +472,9 @@ def load(self): def save(self): setting = config.setting setting["acousticbrainz_add_simplemood"] = self.ui.add_simplemood.isChecked() + setting["acousticbrainz_simplemood_tagname"] = string_(self.ui.simplemood_tagname.text()) setting["acousticbrainz_add_simplegenre"] = self.ui.add_simplegenre.isChecked() + setting["acousticbrainz_simplegenre_tagname"] = string_(self.ui.simplegenre_tagname.text()) setting["acousticbrainz_add_keybpm"] = self.ui.add_keybpm.isChecked() setting["acousticbrainz_add_fullhighlevel"] = self.ui.add_fullhighlevel.isChecked() setting["acousticbrainz_add_sublowlevel"] = self.ui.add_sublowlevel.isChecked() diff --git a/plugins/acousticbrainz/ui_options_acousticbrainz_tags.py b/plugins/acousticbrainz/ui_options_acousticbrainz_tags.py index f1b0eb79..699f62b5 100644 --- a/plugins/acousticbrainz/ui_options_acousticbrainz_tags.py +++ b/plugins/acousticbrainz/ui_options_acousticbrainz_tags.py @@ -26,9 +26,25 @@ def setupUi(self, AcousticBrainzOptionsPage): self.add_simplemood = QtWidgets.QCheckBox(self.acousticbrainzTags_groupBox) self.add_simplemood.setObjectName("add_simplemood") self.verticalLayout_2.addWidget(self.add_simplemood) + + self.simplemood_tagname_label = QtWidgets.QLabel(self.acousticbrainzTags_groupBox) + self.simplemood_tagname_label.setObjectName("simplemood_tagname_label") + self.verticalLayout_2.addWidget(self.simplemood_tagname_label) + self.simplemood_tagname = QtWidgets.QLineEdit(self.acousticbrainzTags_groupBox) + self.simplemood_tagname.setObjectName("simplemood_tagname") + self.verticalLayout_2.addWidget(self.simplemood_tagname) + self.add_simplegenre = QtWidgets.QCheckBox(self.acousticbrainzTags_groupBox) self.add_simplegenre.setObjectName("add_simplegenre") self.verticalLayout_2.addWidget(self.add_simplegenre) + + self.simplegenre_tagname_label = QtWidgets.QLabel(self.acousticbrainzTags_groupBox) + self.simplegenre_tagname_label.setObjectName("simplegenre_tagname_label") + self.verticalLayout_2.addWidget(self.simplegenre_tagname_label) + self.simplegenre_tagname = QtWidgets.QLineEdit(self.acousticbrainzTags_groupBox) + self.simplegenre_tagname.setObjectName("simplegenre_tagname") + self.verticalLayout_2.addWidget(self.simplegenre_tagname) + self.add_keybpm = QtWidgets.QCheckBox(self.acousticbrainzTags_groupBox) self.add_keybpm.setObjectName("add_keybpm") self.verticalLayout_2.addWidget(self.add_keybpm) @@ -55,7 +71,9 @@ def retranslateUi(self, AcousticBrainzOptionsPage): _translate = QtCore.QCoreApplication.translate self.acousticbrainzTags_groupBox.setTitle(_translate("AcousticBrainzOptionsPage", "AcousticBrainz Tags")) self.add_simplemood.setText(_translate("AcousticBrainzOptionsPage", "Add simple Mood tags")) + self.simplemood_tagname_label.setText(_translate("AcousticBrainzOptionsPage", "Mood tag name:")) self.add_simplegenre.setText(_translate("AcousticBrainzOptionsPage", "Add simple Genre tags")) + self.simplegenre_tagname_label.setText(_translate("AcousticBrainzOptionsPage", "Genre tag name:")) self.add_keybpm.setText(_translate("AcousticBrainzOptionsPage", "Add simple BPM and Key tags")) self.add_fullhighlevel.setText(_translate("AcousticBrainzOptionsPage", "Add all highlevel AcousticBrainz tags")) self.add_sublowlevel.setText(_translate("AcousticBrainzOptionsPage", "Add a subset of the lowlevel AcousticBrainz tags")) diff --git a/plugins/acousticbrainz/ui_options_acousticbrainz_tags.ui b/plugins/acousticbrainz/ui_options_acousticbrainz_tags.ui index bae5f956..5281af3f 100644 --- a/plugins/acousticbrainz/ui_options_acousticbrainz_tags.ui +++ b/plugins/acousticbrainz/ui_options_acousticbrainz_tags.ui @@ -30,6 +30,16 @@ + + + + Mood tag name: + + + + + + @@ -38,6 +48,16 @@ + + + + Genre tag name: + + + + + + Add simple BPM and Key tags From 44d299813529fff2605ae92aff76140df370d784 Mon Sep 17 00:00:00 2001 From: regorxxx Date: Wed, 25 May 2022 12:09:44 +0200 Subject: [PATCH 2/3] Replace string_ with str. --- plugins/acousticbrainz/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/acousticbrainz/__init__.py b/plugins/acousticbrainz/__init__.py index d3288122..92cdbb85 100644 --- a/plugins/acousticbrainz/__init__.py +++ b/plugins/acousticbrainz/__init__.py @@ -472,9 +472,9 @@ def load(self): def save(self): setting = config.setting setting["acousticbrainz_add_simplemood"] = self.ui.add_simplemood.isChecked() - setting["acousticbrainz_simplemood_tagname"] = string_(self.ui.simplemood_tagname.text()) + setting["acousticbrainz_simplemood_tagname"] = str(self.ui.simplemood_tagname.text()) setting["acousticbrainz_add_simplegenre"] = self.ui.add_simplegenre.isChecked() - setting["acousticbrainz_simplegenre_tagname"] = string_(self.ui.simplegenre_tagname.text()) + setting["acousticbrainz_simplegenre_tagname"] = str(self.ui.simplegenre_tagname.text()) setting["acousticbrainz_add_keybpm"] = self.ui.add_keybpm.isChecked() setting["acousticbrainz_add_fullhighlevel"] = self.ui.add_fullhighlevel.isChecked() setting["acousticbrainz_add_sublowlevel"] = self.ui.add_sublowlevel.isChecked() From bc7c0ee790addf4527a1c51bc8e1ecc0f66fab70 Mon Sep 17 00:00:00 2001 From: regorxxx Date: Sun, 5 Jun 2022 19:24:07 +0200 Subject: [PATCH 3/3] Reverted change to authors with old e-mail format. --- plugins/acousticbrainz/__init__.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/acousticbrainz/__init__.py b/plugins/acousticbrainz/__init__.py index 92cdbb85..af282e20 100644 --- a/plugins/acousticbrainz/__init__.py +++ b/plugins/acousticbrainz/__init__.py @@ -22,10 +22,10 @@ # ============================================================================= PLUGIN_NAME = 'AcousticBrainz Tags' -PLUGIN_AUTHOR = ('Wargreen, ' - 'Hugo Geoffroy "pistache", ' - 'Philipp Wolfer, ' - 'Regorxxx') +PLUGIN_AUTHOR = ('Wargreen , ' + 'Hugo Geoffroy "pistache" , ' + 'Philipp Wolfer , ' + 'Regorxxx ') PLUGIN_DESCRIPTION = ''' Tag files with tags from the AcousticBrainz database, all highlevel classifiers and tonal/rhythm data.