From 9c8bce40501dceddfc310fd25dc5571113c526b2 Mon Sep 17 00:00:00 2001 From: Bob Swift Date: Sat, 21 Oct 2023 11:13:54 -0600 Subject: [PATCH] Use configured 'join_genres' setting to split genres. --- plugins/genre_mapper/__init__.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/plugins/genre_mapper/__init__.py b/plugins/genre_mapper/__init__.py index 8bfdddfc..2ca4d717 100644 --- a/plugins/genre_mapper/__init__.py +++ b/plugins/genre_mapper/__init__.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# Copyright (C) 2022 Bob Swift (rdswift) +# Copyright (C) 2022-2023 Bob Swift (rdswift) # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -28,8 +28,8 @@

Please see the user guide on GitHub for more information. ''' -PLUGIN_VERSION = '0.4' -PLUGIN_API_VERSIONS = ['2.0', '2.1', '2.2', '2.3', '2.6', '2.7', '2.8'] +PLUGIN_VERSION = '0.5' +PLUGIN_API_VERSIONS = ['2.0', '2.1', '2.2', '2.3', '2.6', '2.7', '2.8', '2.9'] PLUGIN_LICENSE = "GPL-2.0" PLUGIN_LICENSE_URL = "https://www.gnu.org/licenses/gpl-2.0.txt" @@ -56,6 +56,7 @@ pairs_split = re.compile(r"\r\n|\n\r|\n").split +OPT_GENRE_SEPARATOR = 'join_genres' OPT_MATCH_ENABLED = 'genre_mapper_enabled' OPT_MATCH_PAIRS = 'genre_mapper_replacement_pairs' OPT_MATCH_FIRST = 'genre_mapper_apply_first_match_only' @@ -148,8 +149,9 @@ def track_genre_mapper(album, metadata, *args): if 'genre' not in metadata or not metadata['genre']: log.debug("%s: No genres found for: \"%s\"", PLUGIN_NAME, metadata['title'],) return + genre_joiner = config.setting[OPT_GENRE_SEPARATOR] if config.setting[OPT_GENRE_SEPARATOR] else MULTI_VALUED_JOINER genres = set() - metadata_genres = str(metadata['genre']).split(MULTI_VALUED_JOINER) + metadata_genres = str(metadata['genre']).split(genre_joiner) for genre in metadata_genres: for (original, replacement) in GenreMappingPairs.pairs: if genre and re.search(original, genre, re.IGNORECASE):