[mb-commits] branch, mbs-3072-ipis, created. MBS-3072, add IPIs to label and artist json serializations for /ws/2.

MusicBrainz Git Server <[email protected]>
Newsgroups gmane.comp.audio.musicbrainz.cvs
Message-ID <E1Tiia1-0006rO-Oq@wiley>
The branch, mbs-3072-ipis has been created
        at  5ea100b16adc54d8264989fb645f0c89d007cb0c (commit)

- Log -----------------------------------------------------------------
commit 5ea100b16adc54d8264989fb645f0c89d007cb0c
Author: warp <[email protected]>
Date:   Wed Dec 12 10:24:44 2012 +0100

    MBS-3072, add IPIs to label and artist json serializations for /ws/2.

diff --git a/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/Artist.pm b/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/Artist.pm
index f9ecf41..75beb5b 100644
--- a/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/Artist.pm
+++ b/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/Artist.pm
@@ -7,6 +7,7 @@ extends 'MusicBrainz::Server::WebService::Serializer::JSON::2';
 with 'MusicBrainz::Server::WebService::Serializer::JSON::2::Role::Aliases';
 with 'MusicBrainz::Server::WebService::Serializer::JSON::2::Role::Annotation';
 with 'MusicBrainz::Server::WebService::Serializer::JSON::2::Role::GID';
+with 'MusicBrainz::Server::WebService::Serializer::JSON::2::Role::IPIs';
 with 'MusicBrainz::Server::WebService::Serializer::JSON::2::Role::LifeSpan';
 with 'MusicBrainz::Server::WebService::Serializer::JSON::2::Role::Rating';
 with 'MusicBrainz::Server::WebService::Serializer::JSON::2::Role::Relationships';
diff --git a/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/Label.pm b/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/Label.pm
index 981a066..330d9ad 100644
--- a/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/Label.pm
+++ b/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/Label.pm
@@ -6,6 +6,7 @@ extends 'MusicBrainz::Server::WebService::Serializer::JSON::2';
 with 'MusicBrainz::Server::WebService::Serializer::JSON::2::Role::Aliases';
 with 'MusicBrainz::Server::WebService::Serializer::JSON::2::Role::Annotation';
 with 'MusicBrainz::Server::WebService::Serializer::JSON::2::Role::GID';
+with 'MusicBrainz::Server::WebService::Serializer::JSON::2::Role::IPIs';
 with 'MusicBrainz::Server::WebService::Serializer::JSON::2::Role::LifeSpan';
 with 'MusicBrainz::Server::WebService::Serializer::JSON::2::Role::Rating';
 with 'MusicBrainz::Server::WebService::Serializer::JSON::2::Role::Relationships';
diff --git a/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/Role/IPIs.pm b/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/Role/IPIs.pm
new file mode 100644
index 0000000..94d0213
--- /dev/null
+++ b/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/Role/IPIs.pm
@@ -0,0 +1,37 @@
+package MusicBrainz::Server::WebService::Serializer::JSON::2::Role::IPIs;
+use Moose::Role;
+use List::UtilsBy qw( sort_by );
+use MusicBrainz::Server::WebService::Serializer::JSON::2::Utils qw( boolean list_of );
+
+around serialize => sub {
+    my ($orig, $self, $entity, $inc, $stash, $toplevel) = @_;
+    my $ret = $self->$orig($entity, $inc, $stash, $toplevel);
+
+    $ret->{ipis} = [ map { $_->ipi } $entity->all_ipi_codes ];
+
+    return $ret;
+};
+
+no Moose::Role;
+1;
+
+=head1 COPYRIGHT
+
+Copyright (C) 2012 MetaBrainz Foundation
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+=cut
+
diff --git a/t/lib/t/MusicBrainz/Server/Controller/WS/2/JSON/BrowseArtists.pm b/t/lib/t/MusicBrainz/Server/Controller/WS/2/JSON/BrowseArtists.pm
index 860c955..e16c7f0 100644
--- a/t/lib/t/MusicBrainz/Server/Controller/WS/2/JSON/BrowseArtists.pm
+++ b/t/lib/t/MusicBrainz/Server/Controller/WS/2/JSON/BrowseArtists.pm
@@ -31,6 +31,7 @@ test 'browse artists via release group' => sub {
                         ended => JSON::false,
                     },
                     type => "Person",
+                    ipis => [],
                 }]
         });
 };
@@ -64,7 +65,8 @@ test 'browse artists via recording' => sub {
                         { "sort-name" => "mflo", name => "mflo" },
                         { "sort-name" => "えむふろう", name => "えむふろう" },
                         { "sort-name" => "エムフロウ", name => "エムフロウ" },
-                        ]
+                        ],
+                    ipis => [],
                 },
                 {
                     id => "a16d1433-ba89-4f72-a47b-a370add0bb55",
@@ -85,6 +87,7 @@ test 'browse artists via recording' => sub {
                         { name => "ボア", "sort-name" => "ボア" },
                         { name => "보아", "sort-name" => "보아" },
                         ],
+                    ipis => [],
                 }]
         });
 };
@@ -113,6 +116,7 @@ test 'browse artists via release, inc=tags+ratings' => sub {
                     type => "Group",
                     rating => { "votes-count" => 3, "value" => 3 },
                     tags => [],
+                    ipis => [],
                 },
                 {
                     id => "97fa3f6e-557c-4227-bc0e-95a7f9f3285d",
@@ -128,6 +132,7 @@ test 'browse artists via release, inc=tags+ratings' => sub {
                     type => JSON::null,
                     rating => { "votes-count" => 0, "value" => JSON::null },
                     tags => [],
+                    ipis => [],
                 },
                 {
                     id => "a16d1433-ba89-4f72-a47b-a370add0bb55",
@@ -150,7 +155,8 @@ test 'browse artists via release, inc=tags+ratings' => sub {
                         { count => 1, name => 'k-pop' },
                         { count => 1, name => 'kpop' },
                         { count => 1, name => 'pop' },
-                        ]
+                        ],
+                    ipis => [],
                 }]
         });
 };
diff --git a/t/lib/t/MusicBrainz/Server/Controller/WS/2/JSON/BrowseLabels.pm b/t/lib/t/MusicBrainz/Server/Controller/WS/2/JSON/BrowseLabels.pm
index a138107..3230486 100644
--- a/t/lib/t/MusicBrainz/Server/Controller/WS/2/JSON/BrowseLabels.pm
+++ b/t/lib/t/MusicBrainz/Server/Controller/WS/2/JSON/BrowseLabels.pm
@@ -32,6 +32,7 @@ test 'browse labels via release' => sub {
                     },
                     disambiguation => "",
                     "label-code" => JSON::null,
+                    ipis => [],
                 }]
         });
 };
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 e2fedf6..1a403ed 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
@@ -33,6 +33,7 @@ test 'browse release group via release' => sub {
                                 name => "Distance",
                                 "sort-name" => "Distance",
                                 disambiguation => "UK dubstep artist Greg Sanders",
+                                ipis => [],
                             },
                             joinphrase => "",
                         }],
@@ -70,6 +71,7 @@ test 'browse release group via artist' => sub {
                                 name => "Distance",
                                 "sort-name" => "Distance",
                                 disambiguation => "UK dubstep artist Greg Sanders",
+                                ipis => [],
                             },
                             joinphrase => "",
                         }],
@@ -94,6 +96,7 @@ test 'browse release group via artist' => sub {
                                 name => "Distance",
                                 "sort-name" => "Distance",
                                 disambiguation => "UK dubstep artist Greg Sanders",
+                                ipis => [],
                             },
                             joinphrase => "",
                         }],
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 51e912f..06c17ba 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
@@ -162,6 +162,7 @@ test 'browse releases via recording' => sub {
                                 "sort-name" => "avex trax",
                                 "label-code" => JSON::null,
                                 disambiguation => "",
+                                ipis => [],
                             }
                         }],
                     disambiguation => "",
@@ -186,6 +187,7 @@ test 'browse releases via recording' => sub {
                                 "sort-name" => "avex trax",
                                 "label-code" => JSON::null,
                                 disambiguation => "",
+                                ipis => [],
                             }
                         }],
                     disambiguation => "",
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 fd5e547..33c762c 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
@@ -50,6 +50,7 @@ test 'basic artist lookup' => sub {
                 ended => JSON::false,
             },
             type => "Person",
+            ipis => [],
         });
 };
 
@@ -74,6 +75,7 @@ test 'basic artist lookup, inc=annotation' => sub {
                 end => JSON::null,
                 ended => JSON::false,
             },
+            ipis => [],
         });
 };
 
@@ -102,6 +104,7 @@ test 'basic artist lookup, inc=aliases' => sub {
                 { name => "ボア", "sort-name" => "ボア" },
                 { name => "보아", "sort-name" => "보아" },
                 ],
+            ipis => [],
         });
 
 };
@@ -151,6 +154,7 @@ test 'basic artist lookup, inc=url-rels' => sub {
                     type => "blog"
                     },
                 ],
+            ipis => [],
         });
 
 };
@@ -201,6 +205,7 @@ test 'artist lookup with releases' => sub {
                     asin => JSON::null,
                 }
                 ],
+            ipis => [],
         });
 };
 
@@ -237,6 +242,7 @@ test 'artist lookup with pseudo-releases' => sub {
                     asin => JSON::null,
                 }
                 ],
+            ipis => [],
         });
 };
 
@@ -305,7 +311,8 @@ test 'artist lookup with releases and discids' => sub {
                             discids => [ { id => "75S7Yp3IiqPVREQhjAjMXPhwz0Y-", sectors => 281289 } ],
                             "track-count" => 12,
                         }]
-                }]
+                }],
+            ipis => [],
         });
 };
 
@@ -341,6 +348,7 @@ test 'artist lookup with recordings and artist credits' => sub {
                                 name => "m-flo",
                                 "sort-name" => "m-flo",
                                 disambiguation => "",
+                                ipis => [],
                             },
                             joinphrase => "♥",
                         },
@@ -351,6 +359,7 @@ test 'artist lookup with recordings and artist credits' => sub {
                                 name => "BoA",
                                 "sort-name" => "BoA",
                                 disambiguation => "",
+                                ipis => [],
                             },
                             joinphrase => ""
                         }
@@ -369,6 +378,7 @@ test 'artist lookup with recordings and artist credits' => sub {
                                 name => "m-flo",
                                 "sort-name" => "m-flo",
                                 disambiguation => "",
+                                ipis => [],
                             },
                             joinphrase => "♥",
                         },
@@ -379,12 +389,14 @@ test 'artist lookup with recordings and artist credits' => sub {
                                 name => "BoA",
                                 "sort-name" => "BoA",
                                 disambiguation => "",
+                                ipis => [],
                             },
                             joinphrase => ""
                         }
                     ]
                 },
-            ]
+            ],
+            ipis => [],
         });
 };
 
@@ -415,7 +427,8 @@ test 'artist lookup with release groups' => sub {
                     "primary-type" => "Single",
                     "secondary-types" => [],
                 }
-            ]
+            ],
+            ipis => [],
         });
 };
 
@@ -451,7 +464,8 @@ test 'single artist release lookup' => sub {
                     barcode => "4988064451180",
                     asin => JSON::null,
                 }
-            ]
+            ],
+            ipis => [],
         });
 };
 
@@ -487,7 +501,8 @@ test 'various artists release lookup' => sub {
                     asin => JSON::null,
                     disambiguation => "",
                 }
-            ]
+            ],
+            ipis => [],
         });
 };
 
@@ -517,7 +532,8 @@ test 'artist lookup with works (using l_artist_work)' => sub {
                     iswcs => [],
                     language => JSON::null,
                 }
-            ]
+            ],
+            ipis => [],
         });
 };
 
@@ -644,7 +660,8 @@ test 'artist lookup with works (using l_recording_work)' => sub {
                     disambiguation => "",
                     iswcs => [],
                     language => JSON::null,
-                }]
+                }],
+            ipis => [],
         });
 };
 
diff --git a/t/lib/t/MusicBrainz/Server/Controller/WS/2/JSON/LookupLabel.pm b/t/lib/t/MusicBrainz/Server/Controller/WS/2/JSON/LookupLabel.pm
index 137f922..6283cd9 100644
--- a/t/lib/t/MusicBrainz/Server/Controller/WS/2/JSON/LookupLabel.pm
+++ b/t/lib/t/MusicBrainz/Server/Controller/WS/2/JSON/LookupLabel.pm
@@ -28,6 +28,7 @@ test 'basic label lookup' => sub {
                 end => JSON::null,
                 ended => JSON::false,
             },
+            ipis => [],
         });
 
 };
@@ -54,6 +55,7 @@ test 'basic label lookup, inc=annotation' => sub {
                 end => JSON::null,
                 ended => JSON::false,
             },
+            ipis => [],
         });
 
 };
@@ -77,7 +79,8 @@ test 'label lookup, inc=aliases' => sub {
                 end => JSON::null,
                 ended => JSON::false,
             },
-            aliases => [ { name => "Planet µ", "sort-name" => "Planet µ" } ]
+            aliases => [ { name => "Planet µ", "sort-name" => "Planet µ" } ],
+            ipis => [],
         });
 
 };
@@ -133,7 +136,8 @@ test 'label lookup with releases, inc=media' => sub {
                     packaging => JSON::null,
                     media => [ { format => "CD", "track-count" => 12, title => JSON::null } ]
                 }
-            ]
+            ],
+            ipis => [],
         });
 };
 
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 5af7a27..6e338b9 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
@@ -176,6 +176,7 @@ test 'recording lookup with artists' => sub {
                         name => "m-flo",
                         "sort-name" => "m-flo",
                         disambiguation => "",
+                        ipis => [],
                     },
                     joinphrase => "♥",
                 },
@@ -186,6 +187,7 @@ test 'recording lookup with artists' => sub {
                         name => "BoA",
                         "sort-name" => "BoA",
                         disambiguation => "",
+                        ipis => [],
                     },
                     joinphrase => "",
                 }
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 f74e6f5..029b44a 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
@@ -158,7 +158,8 @@ test 'release lookup with artists + aliases' => sub {
                             { "sort-name" => "mflo", name => "mflo" },
                             { "sort-name" => "えむふろう", name => "えむふろう" },
                             { "sort-name" => "エムフロウ", name => "エムフロウ" },
-                            ]
+                            ],
+                        ipis => [],
                     }
                 }],
             date => "2004-03-17",
@@ -195,6 +196,7 @@ test 'release lookup with labels and recordings' => sub {
                         "sort-name" => "rhythm zone",
                         disambiguation => "",
                         "label-code" => JSON::null,
+                        ipis => [],
                     }
                 }],
             media => [
@@ -267,6 +269,7 @@ test 'release lookup with release-groups' => sub {
                       name => "m-flo",
                       "sort-name" => "m-flo",
                       disambiguation => "",
+                      ipis => [],
                    },
                    joinphrase => '',
                 }
@@ -286,6 +289,7 @@ test 'release lookup with release-groups' => sub {
                           name => "m-flo",
                           "sort-name" => "m-flo",
                           disambiguation => "",
+                          ipis => [],
                        },
                        joinphrase => "",
                     }
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 d350fa7..26c5d94 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
@@ -94,6 +94,7 @@ test 'release group lookup with artists' => sub {
                         name => "Distance",
                         "sort-name" => "Distance",
                         disambiguation => "UK dubstep artist Greg Sanders",
+                        ipis => [],
                     },
                     joinphrase => "",
                 }],
@@ -121,6 +122,7 @@ test 'release group lookup with inc=artists+releases+tags+ratings' => sub {
                         name => "m-flo",
                         "sort-name" => "m-flo",
                         disambiguation => "",
+                        ipis => [],
                     },
                     joinphrase => "",
                 }],
@@ -164,6 +166,7 @@ test 'release group lookup with pseudo-releases' => sub {
                         name => "m-flo",
                         "sort-name" => "m-flo",
                         disambiguation => "",
+                        ipis => [],
                     },
                     joinphrase => "",
                 }],

-----------------------------------------------------------------------


hooks/post-receive
-- 
mb_server

_______________________________________________
MusicBrainz-commits mailing list
[email protected]
http://lists.musicbrainz.org/mailman/listinfo/musicbrainz-commits
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.