diff --git a/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/Artist.pm b/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/Artist.pm index 35992301cc3..fc521df0e35 100644 --- a/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/Artist.pm +++ b/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/Artist.pm @@ -13,14 +13,14 @@ sub serialize $body{'sort-name'} = $entity->sort_name; $body{disambiguation} = $entity->comment // ''; + $body{country} = $entity->area && $entity->area->country_code + ? $entity->area->country_code : JSON::null; + if ($toplevel) { $body{gender} = $entity->gender ? $entity->gender_name : JSON::null; $body{'gender-id'} = $entity->gender ? $entity->gender->gid : JSON::null; - $body{country} = $entity->area && $entity->area->country_code - ? $entity->area->country_code : JSON::null; - $body{area} = $entity->area ? serialize_entity($entity->area) : JSON::null; $body{'begin-area'} = $entity->begin_area ? serialize_entity($entity->begin_area) : JSON::null; $body{'end-area'} = $entity->end_area ? serialize_entity($entity->end_area) : JSON::null; diff --git a/t/lib/t/MusicBrainz/Server/Controller/WS/2/JSON/BrowseReleaseGroups.pm b/t/lib/t/MusicBrainz/Server/Controller/WS/2/JSON/BrowseReleaseGroups.pm index b9f3c913546..581a6a767bd 100644 --- a/t/lib/t/MusicBrainz/Server/Controller/WS/2/JSON/BrowseReleaseGroups.pm +++ b/t/lib/t/MusicBrainz/Server/Controller/WS/2/JSON/BrowseReleaseGroups.pm @@ -37,6 +37,7 @@ test 'browse release group via release' => sub { name => 'Distance', 'sort-name' => 'Distance', disambiguation => 'UK dubstep artist Greg Sanders', + country => 'GB', tags => [], genres => [], 'type' => 'Person', @@ -84,6 +85,7 @@ test 'browse release group via artist' => sub { name => 'Distance', 'sort-name' => 'Distance', disambiguation => 'UK dubstep artist Greg Sanders', + country => 'GB', tags => [], genres => [], 'type' => 'Person', @@ -118,6 +120,7 @@ test 'browse release group via artist' => sub { name => 'Distance', 'sort-name' => 'Distance', disambiguation => 'UK dubstep artist Greg Sanders', + country => 'GB', tags => [], genres => [], 'type' => 'Person', @@ -172,6 +175,7 @@ test 'browse official release groups via artist' => sub { name => 'Distance', 'sort-name' => 'Distance', disambiguation => 'UK dubstep artist Greg Sanders', + country => 'GB', tags => [], genres => [], 'type' => 'Person', diff --git a/t/lib/t/MusicBrainz/Server/Controller/WS/2/JSON/BrowseReleases.pm b/t/lib/t/MusicBrainz/Server/Controller/WS/2/JSON/BrowseReleases.pm index 2e5775cca84..6d83b263d71 100644 --- a/t/lib/t/MusicBrainz/Server/Controller/WS/2/JSON/BrowseReleases.pm +++ b/t/lib/t/MusicBrainz/Server/Controller/WS/2/JSON/BrowseReleases.pm @@ -342,6 +342,7 @@ test 'browse releases via recording, with recording rels' => sub { 'sort-name' => 'Blind Melon', disambiguation => '', name => 'Blind Melon', + country => 'US', 'type' => 'Group', 'type-id' => 'e431f5f6-b5d2-343d-8b36-72607fffb74b', }, @@ -383,6 +384,7 @@ test 'browse releases via recording, with recording rels' => sub { 'sort-name' => 'Allgood, Paul', disambiguation => '', name => 'Paul Allgood', + country => 'US', 'type' => 'Person', 'type-id' => 'b6e035f4-3ce9-331c-97df-83397230b0df', }, diff --git a/t/lib/t/MusicBrainz/Server/Controller/WS/2/JSON/LookupArtist.pm b/t/lib/t/MusicBrainz/Server/Controller/WS/2/JSON/LookupArtist.pm index f317be2c6e1..da0fe83907e 100644 --- a/t/lib/t/MusicBrainz/Server/Controller/WS/2/JSON/LookupArtist.pm +++ b/t/lib/t/MusicBrainz/Server/Controller/WS/2/JSON/LookupArtist.pm @@ -656,6 +656,7 @@ test 'artist lookup with recordings and artist credits' => sub { name => 'm-flo', 'sort-name' => 'm-flo', disambiguation => '', + country => 'JP', type => 'Group', 'type-id' => 'e431f5f6-b5d2-343d-8b36-72607fffb74b', }, @@ -668,6 +669,7 @@ test 'artist lookup with recordings and artist credits' => sub { name => 'BoA', 'sort-name' => 'BoA', disambiguation => '', + country => 'KR', 'type' => 'Person', 'type-id' => 'b6e035f4-3ce9-331c-97df-83397230b0df', }, @@ -689,6 +691,7 @@ test 'artist lookup with recordings and artist credits' => sub { name => 'm-flo', 'sort-name' => 'm-flo', disambiguation => '', + country => 'JP', type => 'Group', 'type-id' => 'e431f5f6-b5d2-343d-8b36-72607fffb74b', }, @@ -701,6 +704,7 @@ test 'artist lookup with recordings and artist credits' => sub { name => 'BoA', 'sort-name' => 'BoA', disambiguation => '', + country => 'KR', 'type' => 'Person', 'type-id' => 'b6e035f4-3ce9-331c-97df-83397230b0df', }, @@ -1154,6 +1158,7 @@ test 'artist lookup with artist relations' => sub { name => '7人祭', 'sort-name' => '7nin Matsuri', disambiguation => '', + country => 'JP', type => 'Group', 'type-id' => 'e431f5f6-b5d2-343d-8b36-72607fffb74b', }, diff --git a/t/lib/t/MusicBrainz/Server/Controller/WS/2/JSON/LookupRecording.pm b/t/lib/t/MusicBrainz/Server/Controller/WS/2/JSON/LookupRecording.pm index 80d03b1d47e..f8548c27815 100644 --- a/t/lib/t/MusicBrainz/Server/Controller/WS/2/JSON/LookupRecording.pm +++ b/t/lib/t/MusicBrainz/Server/Controller/WS/2/JSON/LookupRecording.pm @@ -135,6 +135,7 @@ test 'recording lookup with releases, release-groups, and artists' => sub { type => 'Group', name => '7人祭', disambiguation => '', + country => 'JP', id => '802673f0-9b88-4e8a-bb5c-dd01d68b086f', 'sort-name' => '7nin Matsuri', }, @@ -358,6 +359,7 @@ test 'recording lookup with artists' => sub { name => 'm-flo', 'sort-name' => 'm-flo', disambiguation => '', + country => 'JP', 'type' => 'Group', 'type-id' => 'e431f5f6-b5d2-343d-8b36-72607fffb74b', }, @@ -370,6 +372,7 @@ test 'recording lookup with artists' => sub { name => 'BoA', 'sort-name' => 'BoA', disambiguation => '', + country => 'KR', 'type' => 'Person', 'type-id' => 'b6e035f4-3ce9-331c-97df-83397230b0df', }, @@ -413,6 +416,7 @@ test 'recording lookup with release relationships' => sub { name => 'Wedlock', 'sort-name' => 'Wedlock', disambiguation => 'USA electro pop', + country => 'US', 'type' => 'Group', 'type-id' => 'e431f5f6-b5d2-343d-8b36-72607fffb74b', }, @@ -443,6 +447,7 @@ test 'recording lookup with release relationships' => sub { name => 'Paul Allgood', 'sort-name' => 'Allgood, Paul', disambiguation => '', + country => 'US', 'type' => JSON::null, 'type-id' => JSON::null, }, @@ -563,6 +568,7 @@ test 'recording lookup with work-level relationships' => sub { disambiguation => 'UK dubstep artist Greg Sanders', id => '472bc127-8861-45e8-bc9e-31e8dd32de7a', name => 'Distance', + country => 'GB', 'sort-name' => 'Distance', 'type' => 'Person', 'type-id' => 'b6e035f4-3ce9-331c-97df-83397230b0df', diff --git a/t/lib/t/MusicBrainz/Server/Controller/WS/2/JSON/LookupRelease.pm b/t/lib/t/MusicBrainz/Server/Controller/WS/2/JSON/LookupRelease.pm index bcc5ab4b418..96f28199edc 100644 --- a/t/lib/t/MusicBrainz/Server/Controller/WS/2/JSON/LookupRelease.pm +++ b/t/lib/t/MusicBrainz/Server/Controller/WS/2/JSON/LookupRelease.pm @@ -330,6 +330,7 @@ test 'release lookup with artists + aliases' => sub { name => 'm-flo', 'sort-name' => 'm-flo', disambiguation => '', + country => 'JP', 'type' => 'Group', 'type-id' => 'e431f5f6-b5d2-343d-8b36-72607fffb74b', aliases => [ @@ -573,6 +574,7 @@ test 'release lookup with release-groups' => sub { name => 'm-flo', 'sort-name' => 'm-flo', disambiguation => '', + country => 'JP', 'type' => 'Group', 'type-id' => 'e431f5f6-b5d2-343d-8b36-72607fffb74b', }, @@ -596,6 +598,7 @@ test 'release lookup with release-groups' => sub { name => 'm-flo', 'sort-name' => 'm-flo', disambiguation => '', + country => 'JP', 'type' => 'Group', 'type-id' => 'e431f5f6-b5d2-343d-8b36-72607fffb74b', }, @@ -1043,6 +1046,7 @@ test 'release lookup, relation attributes' => sub { 'sort-name' => 'Lee, Soo-Man', disambiguation => '', name => '이수만', + country => 'KR', 'type' => 'Person', 'type-id' => 'b6e035f4-3ce9-331c-97df-83397230b0df', }, @@ -1113,6 +1117,7 @@ test 'release lookup, related artists have no tags/genres' => sub { id => '3088b672-fba9-4b4b-8ae0-dce13babfbb4', name => 'Plone', 'sort-name' => 'Plone', + country => 'GB', 'type' => 'Group', 'type-id' => 'e431f5f6-b5d2-343d-8b36-72607fffb74b', tags => [ @@ -1171,6 +1176,7 @@ test 'release lookup, related artists have no tags/genres' => sub { id => '3088b672-fba9-4b4b-8ae0-dce13babfbb4', name => 'Plone', 'sort-name' => 'Plone', + country => 'GB', 'type' => 'Group', 'type-id' => 'e431f5f6-b5d2-343d-8b36-72607fffb74b', }, @@ -1211,6 +1217,7 @@ test 'release lookup, related artists have no tags/genres' => sub { id => '3088b672-fba9-4b4b-8ae0-dce13babfbb4', name => 'Plone', 'sort-name' => 'Plone', + country => 'GB', 'type' => 'Group', 'type-id' => 'e431f5f6-b5d2-343d-8b36-72607fffb74b', }, @@ -1250,6 +1257,7 @@ test 'release lookup, related artists have no tags/genres' => sub { id => '3088b672-fba9-4b4b-8ae0-dce13babfbb4', name => 'Plone', 'sort-name' => 'Plone', + country => 'GB', 'type' => 'Group', 'type-id' => 'e431f5f6-b5d2-343d-8b36-72607fffb74b', }, @@ -1289,6 +1297,7 @@ test 'release lookup, related artists have no tags/genres' => sub { id => '3088b672-fba9-4b4b-8ae0-dce13babfbb4', name => 'Plone', 'sort-name' => 'Plone', + country => 'GB', 'type' => 'Group', 'type-id' => 'e431f5f6-b5d2-343d-8b36-72607fffb74b', }, @@ -1328,6 +1337,7 @@ test 'release lookup, related artists have no tags/genres' => sub { id => '3088b672-fba9-4b4b-8ae0-dce13babfbb4', name => 'Plone', 'sort-name' => 'Plone', + country => 'GB', 'type' => 'Group', 'type-id' => 'e431f5f6-b5d2-343d-8b36-72607fffb74b', }, @@ -1367,6 +1377,7 @@ test 'release lookup, related artists have no tags/genres' => sub { id => '3088b672-fba9-4b4b-8ae0-dce13babfbb4', name => 'Plone', 'sort-name' => 'Plone', + country => 'GB', 'type' => 'Group', 'type-id' => 'e431f5f6-b5d2-343d-8b36-72607fffb74b', }, @@ -1406,6 +1417,7 @@ test 'release lookup, related artists have no tags/genres' => sub { id => '3088b672-fba9-4b4b-8ae0-dce13babfbb4', name => 'Plone', 'sort-name' => 'Plone', + country => 'GB', 'type' => 'Group', 'type-id' => 'e431f5f6-b5d2-343d-8b36-72607fffb74b', }, @@ -1445,6 +1457,7 @@ test 'release lookup, related artists have no tags/genres' => sub { id => '3088b672-fba9-4b4b-8ae0-dce13babfbb4', name => 'Plone', 'sort-name' => 'Plone', + country => 'GB', 'type' => 'Group', 'type-id' => 'e431f5f6-b5d2-343d-8b36-72607fffb74b', }, @@ -1484,6 +1497,7 @@ test 'release lookup, related artists have no tags/genres' => sub { id => '3088b672-fba9-4b4b-8ae0-dce13babfbb4', name => 'Plone', 'sort-name' => 'Plone', + country => 'GB', 'type' => 'Group', 'type-id' => 'e431f5f6-b5d2-343d-8b36-72607fffb74b', }, @@ -1523,6 +1537,7 @@ test 'release lookup, related artists have no tags/genres' => sub { id => '3088b672-fba9-4b4b-8ae0-dce13babfbb4', name => 'Plone', 'sort-name' => 'Plone', + country => 'GB', 'type' => 'Group', 'type-id' => 'e431f5f6-b5d2-343d-8b36-72607fffb74b', }, @@ -1557,6 +1572,7 @@ test 'release lookup, related artists have no tags/genres' => sub { id => '3088b672-fba9-4b4b-8ae0-dce13babfbb4', name => 'Plone', 'sort-name' => 'Plone', + country => 'GB', 'type' => 'Group', 'type-id' => 'e431f5f6-b5d2-343d-8b36-72607fffb74b', }, @@ -1606,6 +1622,7 @@ test 'release lookup, pregap track' => sub { id => '38c5cdab-5d6d-43d1-85b0-dac41bde186e', name => 'Blind Melon', 'sort-name' => 'Blind Melon', + country => 'US', 'type' => 'Group', 'type-id' => 'e431f5f6-b5d2-343d-8b36-72607fffb74b', }, @@ -1725,6 +1742,7 @@ test 'MBS-7914' => sub { id => '8d610e51-64b4-4654-b8df-064b0fb7a9d9', name => 'Gustav Mahler', 'sort-name' => 'Mahler, Gustav', + country => 'AT', 'type' => 'Person', 'type-id' => 'b6e035f4-3ce9-331c-97df-83397230b0df', }, @@ -1767,6 +1785,7 @@ test 'MBS-7914' => sub { id => '8d610e51-64b4-4654-b8df-064b0fb7a9d9', name => 'Gustav Mahler', 'sort-name' => 'Mahler, Gustav', + country => 'AT', 'type' => 'Person', 'type-id' => 'b6e035f4-3ce9-331c-97df-83397230b0df', }, @@ -1796,6 +1815,7 @@ test 'MBS-7914' => sub { id => '509c772e-1164-4457-8d09-0553cfa77d64', name => 'Chicago Symphony Orchestra', 'sort-name' => 'Chicago Symphony Orchestra', + country => 'US', 'type' => 'Orchestra', 'type-id' => 'a0b36c92-3eb1-3839-a4f9-4799823f54a5', }, @@ -1849,6 +1869,7 @@ test 'tags and genres on associated entities' => sub { id => 'c369975a-7381-4afd-9c36-1d8fe5115e28', name => 'Lori Cooke', 'sort-name' => 'Cooke, Lori', + country => '', 'type' => 'Person', 'type-id' => 'b6e035f4-3ce9-331c-97df-83397230b0df', tags => [ @@ -1898,6 +1919,7 @@ test 'tags and genres on associated entities' => sub { id => 'c369975a-7381-4afd-9c36-1d8fe5115e28', name => 'Lori Cooke', 'sort-name' => 'Cooke, Lori', + country => '', 'type' => 'Person', 'type-id' => 'b6e035f4-3ce9-331c-97df-83397230b0df', }, @@ -1918,6 +1940,7 @@ test 'tags and genres on associated entities' => sub { id => '561e53a1-9ae6-4d85-95c0-a39b028eabe4', name => 'Frances Jones', 'sort-name' => 'Jones, Frances', + country => '', 'type' => 'Person', 'type-id' => 'b6e035f4-3ce9-331c-97df-83397230b0df', tags => [ @@ -1944,6 +1967,7 @@ test 'tags and genres on associated entities' => sub { id => '95ffd873-9901-4ebd-b07d-eb1fe4485baf', name => 'Lavone Grimm', 'sort-name' => 'Grimm, Lavone', + country => '', 'type' => 'Person', 'type-id' => 'b6e035f4-3ce9-331c-97df-83397230b0df', tags => [ @@ -1969,6 +1993,7 @@ test 'tags and genres on associated entities' => sub { id => 'c369975a-7381-4afd-9c36-1d8fe5115e28', name => 'Lori Cooke', 'sort-name' => 'Cooke, Lori', + country => '', 'type' => 'Person', 'type-id' => 'b6e035f4-3ce9-331c-97df-83397230b0df', }, @@ -1981,6 +2006,7 @@ test 'tags and genres on associated entities' => sub { id => '561e53a1-9ae6-4d85-95c0-a39b028eabe4', name => 'Frances Jones', 'sort-name' => 'Jones, Frances', + country => '', 'type' => 'Person', 'type-id' => 'b6e035f4-3ce9-331c-97df-83397230b0df', }, @@ -2001,6 +2027,7 @@ test 'tags and genres on associated entities' => sub { id => '9084ad69-7e81-44f9-a195-a522a9b7b08b', name => 'Leslie Rice', 'sort-name' => 'Rice, Leslie', + country => '', 'type' => 'Character', 'type-id' => '5c1375b0-f18d-3db7-a164-a49d7a63773f', tags => [ @@ -2050,6 +2077,7 @@ test 'tags and genres on associated entities' => sub { id => 'c369975a-7381-4afd-9c36-1d8fe5115e28', name => 'Lori Cooke', 'sort-name' => 'Cooke, Lori', + country => '', 'type' => 'Person', 'type-id' => 'b6e035f4-3ce9-331c-97df-83397230b0df', }, @@ -2070,6 +2098,7 @@ test 'tags and genres on associated entities' => sub { id => '561e53a1-9ae6-4d85-95c0-a39b028eabe4', name => 'Frances Jones', 'sort-name' => 'Jones, Frances', + country => '', 'type' => 'Person', 'type-id' => 'b6e035f4-3ce9-331c-97df-83397230b0df', tags => [ diff --git a/t/lib/t/MusicBrainz/Server/Controller/WS/2/JSON/LookupReleaseGroup.pm b/t/lib/t/MusicBrainz/Server/Controller/WS/2/JSON/LookupReleaseGroup.pm index b09320e42dd..73349d536b1 100644 --- a/t/lib/t/MusicBrainz/Server/Controller/WS/2/JSON/LookupReleaseGroup.pm +++ b/t/lib/t/MusicBrainz/Server/Controller/WS/2/JSON/LookupReleaseGroup.pm @@ -117,6 +117,7 @@ test 'release group lookup with artists' => sub { name => 'Distance', 'sort-name' => 'Distance', disambiguation => 'UK dubstep artist Greg Sanders', + country => 'GB', 'type' => 'Person', 'type-id' => 'b6e035f4-3ce9-331c-97df-83397230b0df', }, @@ -148,6 +149,7 @@ test 'release group lookup with inc=artists+releases+tags+ratings' => sub { name => 'm-flo', 'sort-name' => 'm-flo', disambiguation => '', + country => 'JP', tags => [], 'type' => 'Group', 'type-id' => 'e431f5f6-b5d2-343d-8b36-72607fffb74b', @@ -210,6 +212,7 @@ test 'release group lookup with pseudo-releases' => sub { name => 'm-flo', 'sort-name' => 'm-flo', disambiguation => '', + country => 'JP', 'type' => 'Group', 'type-id' => 'e431f5f6-b5d2-343d-8b36-72607fffb74b', }, diff --git a/t/lib/t/MusicBrainz/Server/Controller/WS/2/JSON/LookupURL.pm b/t/lib/t/MusicBrainz/Server/Controller/WS/2/JSON/LookupURL.pm index caf66fa4ce1..79ebfc30c87 100644 --- a/t/lib/t/MusicBrainz/Server/Controller/WS/2/JSON/LookupURL.pm +++ b/t/lib/t/MusicBrainz/Server/Controller/WS/2/JSON/LookupURL.pm @@ -45,6 +45,7 @@ test 'basic url lookup' => sub { disambiguation => '', 'type' => 'Person', 'type-id' => 'b6e035f4-3ce9-331c-97df-83397230b0df', + country => 'US', }, ended => JSON::false, begin => JSON::null,