Skip to content

Commit

Permalink
musicbrainz.org changed something, the guid urls now contain a versio…
Browse files Browse the repository at this point in the history
…n number, making them three components rather than two... changed the code to extract type and gid as the last two compoents always, rather than matching on the entire url
  • Loading branch information
thwarted committed Dec 10, 2005
1 parent 34241da commit 9f94b01
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/Thundaural/Rip/Lookup/MusicBrainzRemote.pm
Expand Up @@ -205,7 +205,14 @@ sub extract_mb_gid {
my $this = shift;
my $url = shift;
# 89ad4ac3-39f7-470e-963a-56509c546377 == various artists gid
my($type, $gid) = $url =~ m/^http:\/\/musicbrainz.org\/([^\/]+)\/([-0-9a-fA-F]+)(\.html)?$/;
# MB apparently changed the format, the URL now has the version number in it as the first
# component, which means that this re won't match because there are three components separated by
# a slash, the version, the type, and the guid, whereas this re only matches two
#my($type, $gid) = $url =~ m/^http:\/\/musicbrainz.org\/([^\/]+)\/([-0-9a-fA-F]+)(\.html)?$/;
my @s = split(m@/@, $url);
my $gid = pop @s;
$gid =~ s/\.html$//g;
my $type = pop @s;
return {type=>$type, gid=>$gid};
}

Expand Down

0 comments on commit 9f94b01

Please sign in to comment.