Created
March 14, 2010 12:58
-
-
Save trapd00r/331950 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/usr/bin/perl | |
# Find similar artists POC | |
# trapd00r 2010 | |
use strict; | |
use warnings; | |
use Audio::MPD; | |
use LWP::Simple; | |
my $mpd = Audio::MPD->new; | |
my $artist = shift // $mpd->current->artist // undef; | |
my $url = "http://ws.audioscrobbler.com/1.0/artist/$artist/similar.txt"; | |
sub fetch_similars { | |
if($artist) { | |
my @fetched = split/\n/, get($url); | |
print "Artists similar to $artist:\n\n"; | |
s/.+,//g for(@fetched); | |
foreach my $sim(@fetched) { | |
print $sim, "\n"; | |
} | |
} | |
else { | |
print "ID3 tag ARTIST missing\n"; | |
exit 0; | |
} | |
exit 0; | |
} | |
&fetch_similars; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment