Skip to content

Instantly share code, notes, and snippets.

@sarahzrf
Created May 2, 2013 01:01
Show Gist options
  • Save sarahzrf/5499507 to your computer and use it in GitHub Desktop.
Save sarahzrf/5499507 to your computer and use it in GitHub Desktop.
#!/usr/bin/perl
use JSON;
use LWP::Simple;
mkdir "album";
get(shift) =~ m/^\s+trackinfo : (.+),$/m;
$dat = from_json($1);
for (@$dat)
{
$_->{title} =~ s/'/'"'"'/g;
$_->{track_num} =~ s/^(\d)$/0\1/;
fork or exec "wget '$_->{file}' -O 'album/$_->{track_num} $_->{title}.mp3'";
}
$pid = wait until $pid < 0;
system "clear";
print "Done!\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment