From 618708916baaec6d91c857c9e6537e2f969ab305 Mon Sep 17 00:00:00 2001 From: Bruno Tournay Date: Tue, 18 Mar 2014 22:03:11 +0100 Subject: [PATCH 1/4] Separator in genre lists can now be configured --- beetsplug/lastgenre/__init__.py | 5 ++++- docs/changelog.rst | 2 ++ docs/plugins/lastgenre.rst | 8 ++++++-- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/beetsplug/lastgenre/__init__.py b/beetsplug/lastgenre/__init__.py index 8c38eac31..4f78f20c9 100644 --- a/beetsplug/lastgenre/__init__.py +++ b/beetsplug/lastgenre/__init__.py @@ -114,7 +114,9 @@ def _strings_to_genre(tags): tags = out tags = [t.title() for t in tags] - return u', '.join(tags[:config['lastgenre']['count'].get(int)]) + return config['lastgenre']['separator'].get().join( + tags[:config['lastgenre']['count'].get(int)] + ) def fetch_genre(lastfm_obj): """Return the genre for a pylast entity or None if no suitable genre @@ -217,6 +219,7 @@ class LastGenrePlugin(plugins.BeetsPlugin): 'source': 'album', 'force': True, 'auto': True, + 'separator': u', ', }) if self.config['auto']: diff --git a/docs/changelog.rst b/docs/changelog.rst index ec2a6cd4f..4b6768d8c 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -27,6 +27,8 @@ New stuff: better proportion to other metrics. Also, options were added to specify custom thresholds and output formats. Thanks to Adam M. * Added the :ref:`after_write ` plugin event. +* :doc:`/plugins/lastgenre`: Separator in genre list can be + customized. Thanks to brilnius. Fixes: diff --git a/docs/plugins/lastgenre.rst b/docs/plugins/lastgenre.rst index e6da9df83..e8db488eb 100644 --- a/docs/plugins/lastgenre.rst +++ b/docs/plugins/lastgenre.rst @@ -92,8 +92,12 @@ of the ``count`` config option:: lastgenre: count: 3 -Comma-separated lists of up to *count* genres will then be used instead of -single genres. +Lists of up to *count* genres will then be used instead of single genres. The +genres are separated by commas by default, but you can change this with the +``separator`` config option:: + + lastgenre: + sepator: ' / ' `Last.fm`_ provides a popularity factor, a.k.a. *weight*, for each tag ranging from 100 for the most popular tag down to 0 for the least popular. From 26abd603c8a8c8253bd20299806418b040675d7a Mon Sep 17 00:00:00 2001 From: Bruno Tournay Date: Tue, 18 Mar 2014 22:12:16 +0100 Subject: [PATCH 2/4] Changelog for previous change (lastgenre separator) --- docs/changelog.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index 4b6768d8c..4d6aa099d 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -27,8 +27,8 @@ New stuff: better proportion to other metrics. Also, options were added to specify custom thresholds and output formats. Thanks to Adam M. * Added the :ref:`after_write ` plugin event. -* :doc:`/plugins/lastgenre`: Separator in genre list can be - customized. Thanks to brilnius. +* :doc:`/plugins/lastgenre`: Separator in genre lists can now be + configured. Thanks to brilnius. Fixes: From 3348c0e3c27652a3df3b07f778420bc020751062 Mon Sep 17 00:00:00 2001 From: Bruno Tournay Date: Wed, 19 Mar 2014 22:12:56 +0100 Subject: [PATCH 3/4] Typo correction --- docs/plugins/lastgenre.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/plugins/lastgenre.rst b/docs/plugins/lastgenre.rst index e8db488eb..7a4d19a51 100644 --- a/docs/plugins/lastgenre.rst +++ b/docs/plugins/lastgenre.rst @@ -97,7 +97,7 @@ genres are separated by commas by default, but you can change this with the ``separator`` config option:: lastgenre: - sepator: ' / ' + separator: ' / ' `Last.fm`_ provides a popularity factor, a.k.a. *weight*, for each tag ranging from 100 for the most popular tag down to 0 for the least popular. From 81b74151ca42effa111fa61a80ed12d53c0df2db Mon Sep 17 00:00:00 2001 From: Bruno Tournay Date: Wed, 19 Mar 2014 22:16:02 +0100 Subject: [PATCH 4/4] Genre separator from config must be unicode string --- beetsplug/lastgenre/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/beetsplug/lastgenre/__init__.py b/beetsplug/lastgenre/__init__.py index 4f78f20c9..c398bf7e3 100644 --- a/beetsplug/lastgenre/__init__.py +++ b/beetsplug/lastgenre/__init__.py @@ -114,7 +114,7 @@ def _strings_to_genre(tags): tags = out tags = [t.title() for t in tags] - return config['lastgenre']['separator'].get().join( + return config['lastgenre']['separator'].get(unicode).join( tags[:config['lastgenre']['count'].get(int)] )