Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PICARD-2141: AcousticBrainz Mood-Genre: Save existing genres before overwriting #296

Open
wants to merge 1 commit into
base: 2.0
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion plugins/acousticbrainz/acousticbrainz.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@
PLUGIN_NAME = 'AcousticBrainz Mood-Genre'
PLUGIN_AUTHOR = 'Andrew Cook, Sambhav Kothari'
PLUGIN_DESCRIPTION = '''Uses AcousticBrainz for mood and genre.
Any existing genres saved in %_mbgenre%.

WARNING: Experimental plugin. All guarantees voided by use.'''
PLUGIN_LICENSE = "GPL-2.0"
PLUGIN_LICENSE_URL = "https://www.gnu.org/licenses/gpl-2.0.txt"
PLUGIN_VERSION = "1.2.1"
PLUGIN_VERSION = "1.2.2"
PLUGIN_API_VERSIONS = ["2.0"]

from functools import partial
Expand Down Expand Up @@ -56,6 +57,7 @@ def result(album, metadata, data, reply, error):
if k.startswith("mood_") and not v["value"].startswith("not_"):
moods.append(v["value"])

metadata["~mbgenre"] = metadata.getall("genre")
metadata["genre"] = genres
metadata["mood"] = moods
log.debug("%s: Track %s (%s) Parsed response (genres: %s, moods: %s)", PLUGIN_NAME, metadata["musicbrainz_recordingid"], metadata["title"], str(genres), str(moods))
Expand Down