Skip to content

Commit 95e85ec

Browse files
committed
Add annotation as a valid inc for browse methods
Also add to lookup event, and parse them in events Fixes #251 Signed-off-by: Alastair Porter <alastair@porter.net.nz>
1 parent 795b7de commit 95e85ec

File tree

4 files changed

+20
-10
lines changed

4 files changed

+20
-10
lines changed

musicbrainzngs/mbxml.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,8 @@ def parse_event(event):
295295
"alias-list": parse_alias_list,
296296
"tag-list": parse_tag_list,
297297
"user-tag-list": parse_tag_list,
298-
"rating": parse_rating}
298+
"rating": parse_rating,
299+
"annotation": parse_annotation}
299300

300301
result.update(parse_attributes(attribs, event))
301302
result.update(parse_elements(elements, inner_els, event))

musicbrainzngs/musicbrainz.py

+10-9
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
"aliases", "annotation"
5252
] + RELATION_INCLUDES + TAG_INCLUDES + RATING_INCLUDES,
5353
'place': ["aliases", "annotation"] + RELATION_INCLUDES + TAG_INCLUDES,
54-
'event': ["aliases"] + TAG_INCLUDES + RATING_INCLUDES + RELATION_INCLUDES,
54+
'event': ["aliases", "annotation"] + TAG_INCLUDES + RATING_INCLUDES + RELATION_INCLUDES,
5555
'recording': [
5656
"artists", "releases", # Subqueries
5757
"discids", "media", "artist-credits", "isrcs",
@@ -83,16 +83,17 @@
8383
'collection': ['releases'],
8484
}
8585
VALID_BROWSE_INCLUDES = {
86-
'artist': ["aliases"] + TAG_INCLUDES + RATING_INCLUDES + RELATION_INCLUDES,
87-
'event': ["aliases"] + TAG_INCLUDES + RATING_INCLUDES + RELATION_INCLUDES,
88-
'label': ["aliases"] + TAG_INCLUDES + RATING_INCLUDES + RELATION_INCLUDES,
89-
'recording': ["artist-credits", "isrcs", "work-level-rels"] + TAG_INCLUDES + RATING_INCLUDES + RELATION_INCLUDES,
90-
'release': ["artist-credits", "labels", "recordings", "isrcs",
86+
'artist': ["annotation", "aliases"] + TAG_INCLUDES + RATING_INCLUDES + RELATION_INCLUDES,
87+
'event': ["annotation", "aliases"] + TAG_INCLUDES + RATING_INCLUDES + RELATION_INCLUDES,
88+
'label': ["annotation", "aliases"] + TAG_INCLUDES + RATING_INCLUDES + RELATION_INCLUDES,
89+
'recording': ["annotation", "artist-credits", "isrcs",
90+
"work-level-rels"] + TAG_INCLUDES + RATING_INCLUDES + RELATION_INCLUDES,
91+
'release': ["annotation", "artist-credits", "labels", "recordings", "isrcs",
9192
"release-groups", "media", "discids"] + RATING_INCLUDES + RELATION_INCLUDES,
92-
'place': ["aliases"] + TAG_INCLUDES + RELATION_INCLUDES,
93-
'release-group': ["artist-credits"] + TAG_INCLUDES + RATING_INCLUDES + RELATION_INCLUDES,
93+
'place': ["annotation", "aliases"] + TAG_INCLUDES + RELATION_INCLUDES,
94+
'release-group': ["annotation", "artist-credits"] + TAG_INCLUDES + RATING_INCLUDES + RELATION_INCLUDES,
9495
'url': RELATION_INCLUDES,
95-
'work': ["aliases", "annotation"] + TAG_INCLUDES + RATING_INCLUDES + RELATION_INCLUDES,
96+
'work': ["annotation", "aliases", "annotation"] + TAG_INCLUDES + RATING_INCLUDES + RELATION_INCLUDES,
9697
}
9798

9899
#: These can be used to filter whenever releases are includes or browsed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<metadata xmlns="http://musicbrainz.org/ns/mmd-2.0#"><artist id="0383dadf-2a4e-4d10-a46a-e9e041da8eb3" type="Group" type-id="e431f5f6-b5d2-343d-8b36-72607fffb74b"><name>Queen</name><sort-name>Queen</sort-name><annotation><text>'''Note:''' Please add any 2011 Remaster releases to either ''Universal Island Records'' or ''Hollywood Records'' and '''not''' '''''Island Records'''''. Any previously added releases which fall under this category should be edited.
3+
----
4+
See also [artist:9dcffd99-eca6-4a09-8dbd-c6c4ed2f20fd|Queen + Paul Rodgers] and [artist:7e07a487-5438-4128-b2d0-f0f18ac08384|Queen + Adam Lambert] for released from Brian May and Roger Taylor collaborating with other singers.</text></annotation><disambiguation>UK rock group</disambiguation><isni-list><isni>0000000115265309</isni></isni-list><country>GB</country><area id="8a754a16-0027-3a29-b6d7-2b40ea0481ed"><name>United Kingdom</name><sort-name>United Kingdom</sort-name><iso-3166-1-code-list><iso-3166-1-code>GB</iso-3166-1-code></iso-3166-1-code-list></area><begin-area id="f03d09b3-39dc-4083-afd6-159e3f0d462f"><name>London</name><sort-name>London</sort-name><disambiguation>Greater London, which includes the City of London</disambiguation></begin-area><life-span><begin>1970-06-27</begin></life-span></artist></metadata>

test/test_mbxml_artist.py

+4
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,7 @@ def testArtistTargets(self):
3131
res = _common.open_and_parse_test_data(self.datadir, "b3785a55-2cf6-497d-b8e3-cfa21a36f997-artist-rels.xml")
3232
self.assertTrue('target-credit' in res['artist']['artist-relation-list'][0])
3333
self.assertEqual(res['artist']['artist-relation-list'][0]["target-credit"], "TAO")
34+
35+
def testArtistAnnotation(self):
36+
res = _common.open_and_parse_test_data(self.datadir, "0383dadf-2a4e-4d10-a46a-e9e041da8eb3-annotation.xml")
37+
self.assertTrue('Please add any 2011 Remaster releases' in res['artist']['annotation']['text'])

0 commit comments

Comments
 (0)