From 321f871805803ab44d6e1d01bb2e13eabb1d6ac9 Mon Sep 17 00:00:00 2001 From: Thomas Vander Stichele Date: Tue, 30 Jul 2013 12:35:23 +0200 Subject: [PATCH] add a test case to fix --- morituri/test/Makefile.am | 1 + ....a76714e0-32b1-4ed4-b28e-f86d99642193.json | 1 + morituri/test/test_common_mbngs.py | 27 +++++++++++++++++++ 3 files changed, 29 insertions(+) create mode 100644 morituri/test/morituri.release.a76714e0-32b1-4ed4-b28e-f86d99642193.json diff --git a/morituri/test/Makefile.am b/morituri/test/Makefile.am index eb3e13d..d5ac917 100644 --- a/morituri/test/Makefile.am +++ b/morituri/test/Makefile.am @@ -37,6 +37,7 @@ EXTRA_DIST = \ release.08397059-86c1-463b-8ed0-cd596dbd174f.xml \ release.93a6268c-ddf1-4898-bf93-fb862b1c5c5e.xml \ release.c7d919f4-3ea0-4c4b-a230-b3605f069440.xml \ + morituri.release.a76714e0-32b1-4ed4-b28e-f86d99642193.json \ morituri.release.3451f29c-9bb8-4cc5-bfcc-bd50104b94f8.json \ kanye.cue \ kings-separate.cue \ diff --git a/morituri/test/morituri.release.a76714e0-32b1-4ed4-b28e-f86d99642193.json b/morituri/test/morituri.release.a76714e0-32b1-4ed4-b28e-f86d99642193.json new file mode 100644 index 0000000..b7390a9 --- /dev/null +++ b/morituri/test/morituri.release.a76714e0-32b1-4ed4-b28e-f86d99642193.json @@ -0,0 +1 @@ +{"release": {"status": "Official", "artist-credit": [{"artist": {"sort-name": "Various Artists", "id": "89ad4ac3-39f7-470e-963a-56509c546377", "name": "Various Artists"}}], "title": "2 Meter Sessies, Volume 10", "label-info-list": [], "medium-list": [{"disc-list": [{"id": "f7XO36a7n1LCCskkCiulReWbwZA-", "sectors": "317128"}], "position": "1", "track-list": [{"recording": {"artist-credit": [{"artist": {"sort-name": "Coldplay", "id": "cc197bad-dc9c-440d-a5b5-d52ba2e14234", "name": "Coldplay"}}], "length": "265200", "artist-credit-phrase": "Coldplay", "id": "06813123-5047-4c94-88bf-6a300540e954", "title": "Trouble"}, "position": "1"}, {"recording": {"artist-credit": [{"artist": {"sort-name": "Live", "id": "cba77ba2-862d-4cee-a8f6-d3f9daf7211c", "name": "Live"}}], "length": "264466", "artist-credit-phrase": "Live", "id": "7b57b108-35bb-4fcb-9046-06228fb7e5f7", "title": "Run to the Water"}, "position": "2"}, {"recording": {"artist-credit": [{"artist": {"sort-name": "Beck", "id": "309c62ba-7a22-4277-9f67-4a162526d18a", "name": "Beck"}}], "length": "384440", "artist-credit-phrase": "Beck", "id": "cfbfb04e-ccfd-4316-a5eb-5e4daa670905", "title": "Debra"}, "position": "3"}, {"recording": {"artist-credit": [{"artist": {"sort-name": "Jayhawks, The", "id": "24ed5b09-02b1-47fe-bd83-6fa5270039b0", "name": "The Jayhawks"}}], "length": "261746", "artist-credit-phrase": "The Jayhawks", "id": "d7b84a3f-628d-49f3-ae2f-b34d5630ee45", "title": "Mr. Wilson"}, "position": "4"}, {"recording": {"artist-credit": [{"artist": {"sort-name": "Dijk, De", "id": "d7a55e92-a14c-4543-8152-de2163af06bb", "name": "De Dijk"}}], "length": "239080", "artist-credit-phrase": "De Dijk", "id": "2bb1a0ca-399a-4488-8a53-bb0ca9ece5ea", "title": "Wie het niet weet"}, "position": "5"}, {"recording": {"artist-credit": [{"artist": {"sort-name": "Torrini, Emil\u00edana", "id": "b2a9731b-9e13-4ff9-af21-5e694a5663e8", "name": "Emil\u00edana Torrini"}}], "length": "209800", "artist-credit-phrase": "Emil\u00edana Torrini", "id": "3e6433da-9af5-41b0-9210-6dbef13c630c", "title": "Summer Breeze"}, "position": "6"}, {"recording": {"artist-credit": [{"artist": {"sort-name": "Hiatt, John", "id": "e78202c9-7717-435c-9aac-dd5ebc4e64d5", "name": "John Hiatt"}}], "length": "159600", "artist-credit-phrase": "John Hiatt", "id": "ce684ade-741f-47f7-ac1c-0d7d206da8a3", "title": "What Do We Do Now"}, "position": "7"}, {"recording": {"artist-credit": [{"artist": {"sort-name": "Hay, Barry & Barking Dogs", "id": "dc11b420-0e21-4e05-aca7-273f58c8bcce", "name": "Barry Hay & Barking Dogs"}}], "length": "184800", "artist-credit-phrase": "Barry Hay & Barking Dogs", "id": "56b1b506-64cd-4c2f-be6d-044e3888dabd", "title": "Happiness Is a Warm Gun"}, "position": "8"}, {"recording": {"artist-credit": [{"artist": {"sort-name": "Penn, Dan", "id": "cc54ec8d-ba66-4051-970d-6b3c24cd9e8b", "name": "Dan Penn"}}, " & ", {"artist": {"sort-name": "Oldham, Spooner", "id": "ba170eca-541b-4ee5-b332-54ff954b75ea", "name": "Spooner Oldham"}}], "length": "231640", "artist-credit-phrase": "Dan Penn & Spooner Oldham", "id": "4d1c6a29-dd96-4af6-a594-622d70e214ac", "title": "I'm Your Puppet"}, "position": "9"}, {"recording": {"artist-credit": [{"artist": {"sort-name": "Stone, Angie", "id": "82f8dd22-0319-4f35-953c-358b3f883027", "name": "Angie Stone"}}], "length": "211800", "artist-credit-phrase": "Angie Stone", "id": "cb0447fc-3ad3-4dea-a94d-517179a6d68c", "title": "Everyday"}, "position": "10"}, {"recording": {"artist-credit": [{"artist": {"sort-name": "Helsen, Tom", "id": "0a5fe43b-ace7-407b-bfc2-be4851e7d3f2", "name": "Tom Helsen"}}], "length": "249693", "artist-credit-phrase": "Tom Helsen", "id": "2f6501f8-262a-4f02-a782-ed365621e100", "title": "When Marvin Calls"}, "position": "11"}, {"recording": {"artist-credit": [{"artist": {"sort-name": "K's Choice", "id": "9bd1e632-b17b-4842-b520-ddfce3b538b9", "name": "K\u2019s Choice"}}], "length": "210666", "artist-credit-phrase": "K\u2019s Choice", "id": "e3ef3fa1-3155-464d-a5e0-4096e9cc63ad", "title": "Almost Happy"}, "position": "12"}, {"recording": {"artist-credit": [{"artist": {"sort-name": "Casey, Paddy", "id": "d36a3897-f76d-4227-be80-d0d7282ff12a", "name": "Paddy Casey"}}], "length": "191000", "artist-credit-phrase": "Paddy Casey", "id": "c419e7a6-cbe7-44c9-a45e-08e0721695dd", "title": "Can't Take That Away"}, "position": "13"}, {"recording": {"artist-credit": [{"artist": {"sort-name": "Jackson, Joe", "id": "07f6d469-38f3-46da-9cfa-2f532422b84e", "name": "Joe Jackson"}}], "length": "267933", "artist-credit-phrase": "Joe Jackson", "id": "ebb7083f-4db2-4daa-a67d-2993887b67ad", "title": "Stranger Than You"}, "position": "14"}, {"recording": {"artist-credit": [{"artist": {"sort-name": "My Morning Jacket", "id": "ea5883b7-68ce-48b3-b115-61746ea53b8c", "name": "My Morning Jacket"}}], "length": "325466", "artist-credit-phrase": "My Morning Jacket", "id": "62594b12-5907-42b6-b7d9-03ad5b0ddd35", "title": "Old September Blues"}, "position": "15"}, {"recording": {"artist-credit": [{"artist": {"sort-name": "Jones, Tom", "id": "57c6f649-6cde-48a7-8114-2a200247601a", "name": "Tom Jones"}}, " & ", {"artist": {"sort-name": "Stereophonics", "id": "0bfba3d3-6a04-4779-bb0a-df07df5b0558", "name": "Stereophonics"}}], "length": "193973", "artist-credit-phrase": "Tom Jones & Stereophonics", "id": "ba50a1c7-9e23-4c3e-b7aa-12e23eea6d19", "title": "Mama Told Me Not to Come"}, "position": "16"}, {"recording": {"artist-credit": [{"artist": {"sort-name": "Christophers, Ben", "id": "1a5b4ad0-593a-4069-a77d-dae722a5f0ac", "name": "Ben Christophers"}}], "length": "223333", "artist-credit-phrase": "Ben Christophers", "id": "c0cfc4cb-8c80-4516-b500-2df010418697", "title": "Sunday"}, "position": "17"}, {"recording": {"artist-credit": [{"artist": {"sort-name": "Barman, Tom", "id": "a9be8bc0-47a4-4a0b-af5f-feac18d3bc43", "name": "Tom Barman"}}, " & ", {"artist": {"sort-name": "Nueten, Van, Guy", "id": "8779d2fd-3fc8-4c1e-a37d-2edf66b07c4e", "name": "Guy Van Nueten"}}], "length": "151733", "artist-credit-phrase": "Tom Barman & Guy Van Nueten", "id": "e423a1d7-3ae1-4540-b267-d873c50043e7", "title": "Magnolia"}, "position": "18"}], "format": "CD"}], "text-representation": {"language": "eng", "script": "Latn"}, "date": "2001-10-15", "artist-credit-phrase": "Various Artists", "quality": "normal", "id": "a76714e0-32b1-4ed4-b28e-f86d99642193"}} \ No newline at end of file diff --git a/morituri/test/test_common_mbngs.py b/morituri/test/test_common_mbngs.py index ba5f30b..f18f3fa 100644 --- a/morituri/test/test_common_mbngs.py +++ b/morituri/test/test_common_mbngs.py @@ -11,6 +11,7 @@ from morituri.common import mbngs class MetadataTestCase(unittest.TestCase): + # Generated with rip -R cd info def testJeffEverybodySingle(self): path = os.path.join(os.path.dirname(__file__), 'morituri.release.3451f29c-9bb8-4cc5-bfcc-bd50104b94f8.json') @@ -22,3 +23,29 @@ class MetadataTestCase(unittest.TestCase): metadata = mbngs._getMetadata({}, response['release'], discid) self.failIf(metadata.release) + + def test2MeterSessies10(self): + # various artists, multiple artists per track + path = os.path.join(os.path.dirname(__file__), + 'morituri.release.a76714e0-32b1-4ed4-b28e-f86d99642193.json') + handle = open(path, "rb") + response = json.loads(handle.read()) + handle.close() + discid = "f7XO36a7n1LCCskkCiulReWbwZA-" + + metadata = mbngs._getMetadata({}, response['release'], discid) + + self.assertEquals(metadata.artist, u'Various Artists') + self.assertEquals(metadata.release, u'2001-10-15') + self.assertEquals(metadata.mbidArtist, + u'89ad4ac3-39f7-470e-963a-56509c546377') + + self.assertEquals(len(metadata.tracks), 18) + + track16 = metadata.tracks[15] + + self.assertEquals(track16.artist, 'Tom Jones & Stereophonics') + # FIXME: this is the disc artist id, and it should be the combo + # of track artist id's + self.assertEquals(track16.mbidArtist, + u'89ad4ac3-39f7-470e-963a-56509c546377')