From 4dd8ade4b5222cd0bb9aa669a0532e50c29045d8 Mon Sep 17 00:00:00 2001 From: Sophist Date: Mon, 21 Apr 2014 21:55:18 +0100 Subject: [PATCH 1/3] Use multi-value %_performance_attributes% ... ... instead of %_performance_live%, etc. Modifies #285. --- NEWS.txt | 3 ++- picard/mbxml.py | 9 +++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/NEWS.txt b/NEWS.txt index 219ffc7f5..e57caa528 100644 --- a/NEWS.txt +++ b/NEWS.txt @@ -43,7 +43,8 @@ * Add checkbox to toggle debug at runtime in log/debug view dialog * Add a plugin to add Artist Official Homepage relationships to the website tag (ID3 WOAR tag) * Add integrated functions $eq_any, $ne_all, $eq_all, $ne_any, $swapprefix and $delprefix. - * Add %_performance_live%, %_performance_cover% etc. if track is shown as live, cover etc. in the MB database. + * Add %_performance_attributes%, containing performance attributes for the work e.g. live, cover, medley etc. + Use $inmulti in file naming scripts i.e. ...$if($inmulti(%_performance_attributes%,medley), (Medley),) Version 1.2 - 2013-03-30 diff --git a/picard/mbxml.py b/picard/mbxml.py index 8c3071493..fd9dc099d 100644 --- a/picard/mbxml.py +++ b/picard/mbxml.py @@ -269,11 +269,12 @@ def recording_to_metadata(node, track): m['~length'] = format_time(m.length) + def performance_to_metadata(relation, m): - if 'attribute_list' in relation.children: - if 'attribute' in relation.attribute_list[0].children: - for attribute in relation.attribute_list[0].attribute: - m["~performance_%s" % attribute.text] = "1" + if 'attribute_list' in relation.children \ + and 'attribute' in relation.attribute_list[0].children: + for attribute in relation.attribute_list[0].attribute: + m.add_unique("~performance_attributes", attribute.text) def work_to_metadata(work, m): From 16a47dae23088e3b7ab665a26163f50062077dc4 Mon Sep 17 00:00:00 2001 From: Sophist Date: Tue, 22 Apr 2014 11:55:11 +0100 Subject: [PATCH 2/3] Fix layout (zas comments) Note: Whilst the previous indentation of "and" was incorrect as per PEP-8, I think it was actually more readable. --- picard/mbxml.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/picard/mbxml.py b/picard/mbxml.py index fd9dc099d..6e9352d10 100644 --- a/picard/mbxml.py +++ b/picard/mbxml.py @@ -269,10 +269,9 @@ def recording_to_metadata(node, track): m['~length'] = format_time(m.length) - def performance_to_metadata(relation, m): if 'attribute_list' in relation.children \ - and 'attribute' in relation.attribute_list[0].children: + and 'attribute' in relation.attribute_list[0].children: for attribute in relation.attribute_list[0].attribute: m.add_unique("~performance_attributes", attribute.text) From b90f87ce12ecc2e2a3a0a237e2ce6a51a47e30e9 Mon Sep 17 00:00:00 2001 From: Sophist Date: Wed, 23 Apr 2014 20:34:16 +0100 Subject: [PATCH 3/3] Fix layouts again (zas comment) --- picard/mbxml.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/picard/mbxml.py b/picard/mbxml.py index 6e9352d10..f14008d28 100644 --- a/picard/mbxml.py +++ b/picard/mbxml.py @@ -270,10 +270,10 @@ def recording_to_metadata(node, track): def performance_to_metadata(relation, m): - if 'attribute_list' in relation.children \ - and 'attribute' in relation.attribute_list[0].children: - for attribute in relation.attribute_list[0].attribute: - m.add_unique("~performance_attributes", attribute.text) + if 'attribute_list' in relation.children: + if 'attribute' in relation.attribute_list[0].children: + for attribute in relation.attribute_list[0].attribute: + m.add_unique("~performance_attributes", attribute.text) def work_to_metadata(work, m):