| View previous topic :: View next topic |
| Author |
Message |
merky1 n00b


Joined: 22 Apr 2003 Posts: 46
|
Posted: Mon Nov 16, 2009 4:22 am Post subject: |
|
|
I did some hacking on this, and it seems to work for both albums and single songs.
Thanks for posting this, otherwise I would have to keep using winders to grab stuffs from Amazon.
| Code: |
#!/usr/bin/perl -w
use strict;
use XML::XPath; #use the xpath language for parsing XML
my $workdir = "/home/smurfoff/AmazonMP3";
chomp $workdir;
(-e $ARGV[0]) || die "File does not exist";
my %song_info;
my @songs;
open (TEMP,">/tmp/amz-xml.out");
print TEMP `clamz -i '$ARGV[0]'`;
close (TEMP);
my $xp = XML::XPath->new(filename => "/tmp/amz-xml.out"); # new parser
my $nodeset = $xp->find('/playlist/trackList/track');
foreach my $tracknode ($nodeset->get_nodelist) {
$song_info{Title}=$tracknode->findvalue('./title');
$song_info{Creator}=$tracknode->findvalue('./creator');
$song_info{Image}=$tracknode->findvalue('./image');
$song_info{Album}=$tracknode->findvalue('./album');
}
my $artist_dir = "/home/smurfoff/AmazonMP3/$song_info{Creator}";
my $album_dir = "$artist_dir/$song_info{Album}";
unless (-e $artist_dir) {
mkdir ($artist_dir) || die "Couldn't make artist dir";
}
mkdir ($album_dir) || die "Couldn't make song dir $album_dir" unless (-e $album_dir);
chdir ($album_dir) || die "Album directory $album_dir not created";
#get album art
system ("wget $song_info{Image}");
my $tmp = reverse($song_info{Image});
$tmp =~ s/^([^\/]+).*/$1/;
system ("mv " . reverse ($tmp) . " cover.jpg");
#actually get songs
system ("clamz '$ARGV[0]'");
sub clean_filename {
my $filename = shift;
$filename =~ tr{*\"><[]|:;,'=/?}{_};
return $filename;
}
|
_________________ ooo000 WoooHooo 000ooo |
|
| Back to top |
|
 |
dcljr Tux's lil' helper


Joined: 20 Aug 2005 Posts: 92 Location: Austin, TX
|
Posted: Mon Jan 18, 2010 9:03 am Post subject: |
|
|
Note to those who are intimidated by all these scripts and ebuilds that people are posting: If you can stomach installing something "manually" (i.e., no emerge), clamz-0.2 (see URL posted by slackbassist above) installed fine for me (x86 system) following the included README, and works perfectly well with no additional scripts required.
I'm posting this just because I was intimidated, and so avoided doing anything about this for months. I finally broke down and installed the program, and it works just fine...
- dcljr |
|
| Back to top |
|
 |
kernelOfTruth Watchman


Joined: 20 Dec 2005 Posts: 5345 Location: Vienna, Austria; Germany; hello world :)
|
|
| Back to top |
|
 |
BitJam Advocate

Joined: 12 Aug 2003 Posts: 2248 Location: Silver City, NM
|
Posted: Wed Jan 26, 2011 6:47 pm Post subject: |
|
|
I have clamz-0.4 installed from source on an amd64 system with multilib and it works great. Give it a shot. See if you can find a free album to test it on. There were a bunch of free albums over the holidays, I imagine there must still be some kicking around.
I see that clamz-0.4 is in portage so you should be able to just "emerge clamz". |
|
| Back to top |
|
 |
cdstealer Guru


Joined: 30 Oct 2005 Posts: 332 Location: Leeds
|
Posted: Tue Nov 22, 2011 8:29 pm Post subject: |
|
|
Cheers BitJam.. perfect! Thanks. _________________ # touch cock
touch: cannot touch `cock': Permission denied |
|
| Back to top |
|
 |
|