From c778309a47c04eb62b6b15c19f4332870cdd44d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20Wei=C3=9Fl?= Date: Wed, 29 Jun 2011 01:56:18 +0200 Subject: [PATCH 1/2] Add release_type.py plugin, from http://sumafi.com/files/release_type.py Author: Elliot Chance --- contrib/plugins/release_type.py | 36 +++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 contrib/plugins/release_type.py diff --git a/contrib/plugins/release_type.py b/contrib/plugins/release_type.py new file mode 100644 index 000000000..5c6487863 --- /dev/null +++ b/contrib/plugins/release_type.py @@ -0,0 +1,36 @@ +PLUGIN_NAME = 'Release Type' +PLUGIN_AUTHOR = 'Elliot Chance' +PLUGIN_DESCRIPTION = 'Appends information to EPs and Singles' +PLUGIN_VERSION = '1.0' +PLUGIN_API_VERSIONS = ["0.9.0"] + +from picard.metadata import register_album_metadata_processor +import re + +#================== +# options +#================== +_SINGLE = " (single)" +_EP = " EP" + +def add_release_type(tagger, metadata, release): + + # make sure "EP" isn't already at the end + if metadata["album"].lower().endswith(" ep"): + return + elif metadata["album"].lower().endswith(" single"): + return + + # check release type + if metadata["releasetype"] == "ep": + rs = _EP; + elif metadata["releasetype"] == "single": + rs = _SINGLE; + else: + rs = "" + + # append title + metadata["album"] = metadata["album"] + rs + +register_album_metadata_processor(add_release_type) + From 495a2bc0d687af75199299d3be1c9be71d360b28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20Wei=C3=9Fl?= Date: Wed, 29 Jun 2011 01:57:04 +0200 Subject: [PATCH 2/2] Update release_type.py plugin This should not happen any more: "EP" -> "EP EP" "Holiday EP #1" -> "Holiday EP #1 EP" Also checked to be working with Picard 0.15. --- contrib/plugins/release_type.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/contrib/plugins/release_type.py b/contrib/plugins/release_type.py index 5c6487863..6984d1008 100644 --- a/contrib/plugins/release_type.py +++ b/contrib/plugins/release_type.py @@ -1,8 +1,8 @@ PLUGIN_NAME = 'Release Type' PLUGIN_AUTHOR = 'Elliot Chance' PLUGIN_DESCRIPTION = 'Appends information to EPs and Singles' -PLUGIN_VERSION = '1.0' -PLUGIN_API_VERSIONS = ["0.9.0"] +PLUGIN_VERSION = '1.2' +PLUGIN_API_VERSIONS = ["0.9.0", "0.10", "0.15"] from picard.metadata import register_album_metadata_processor import re @@ -15,11 +15,11 @@ _EP = " EP" def add_release_type(tagger, metadata, release): - # make sure "EP" isn't already at the end - if metadata["album"].lower().endswith(" ep"): - return - elif metadata["album"].lower().endswith(" single"): - return + # make sure "EP" (or "single", ...) is not already a word in the name + words = metadata["album"].lower().split(" ") + for word in ["ep", "e.p.", "single", "(single)"]: + if word in words: + return # check release type if metadata["releasetype"] == "ep":