forked from bfaist/webservice-musicbrainz
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
discid queries are different lookup type (a bit like MBID) and require a bit of special casing, but are pretty straightforward otherwise. The `inc` parameter for discid queries supports the same values as `release` according to the API doc.
- Loading branch information
1 parent
9d16fbb
commit 5d92749
Showing
5 changed files
with
58 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,4 @@ pm_to_blib | |
*.bak | ||
*.old | ||
*.skip | ||
Makefile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
use strict; | ||
use Test::More; | ||
|
||
use WebService::MusicBrainz; | ||
use Data::Dumper; | ||
|
||
my $ws = WebService::MusicBrainz->new(); | ||
ok($ws); | ||
|
||
my $s1_res = $ws->search(discid => { discid => 'NmFqfPXBZfk05ZpbTcL.IvmEtQY-' }); | ||
ok($s1_res->{'offset-count'} eq 16); | ||
ok(@{$s1_res->{offsets}} eq 16); | ||
ok($s1_res->{offsets}->[0] eq 150); | ||
ok($s1_res->{offsets}->[1] eq 20822); | ||
ok($s1_res->{offsets}->[2] eq 39976); | ||
ok($s1_res->{offsets}->[3] eq 57651); | ||
ok($s1_res->{offsets}->[4] eq 82691); | ||
ok($s1_res->{offsets}->[5] eq 97773); | ||
ok($s1_res->{offsets}->[6] eq 116625); | ||
ok($s1_res->{offsets}->[7] eq 140670); | ||
ok($s1_res->{offsets}->[8] eq 160155); | ||
ok($s1_res->{offsets}->[9] eq 183516); | ||
ok($s1_res->{offsets}->[10] eq 194429); | ||
ok($s1_res->{offsets}->[11] eq 210901); | ||
ok($s1_res->{offsets}->[12] eq 228250); | ||
ok($s1_res->{offsets}->[13] eq 246216); | ||
ok($s1_res->{offsets}->[14] eq 272031); | ||
ok($s1_res->{offsets}->[15] eq 285133); | ||
ok($s1_res->{id} eq 'NmFqfPXBZfk05ZpbTcL.IvmEtQY-'); | ||
ok($s1_res->{sectors} eq 308410); | ||
ok(@{$s1_res->{releases}} > 0); | ||
ok(not defined @{$s1_res->{releases}}[0]->{'artist-credit'}); | ||
sleep(1); | ||
|
||
my $s2_res = $ws->search(discid => { discid => 'NmFqfPXBZfk05ZpbTcL.IvmEtQY-', inc => ' artists' }); | ||
ok(@{$s2_res->{releases}} > 0); | ||
ok(defined @{$s2_res->{releases}}[0]->{'artist-credit'}); | ||
ok(defined @{$s2_res->{releases}}[0]->{'artist-credit'}->[0]->{artist}); | ||
ok(@{$s2_res->{releases}}[0]->{'artist-credit'}->[0]->{artist}->{'sort-name'} eq 'Adams, Ryan'); | ||
|
||
done_testing(); |