-
Notifications
You must be signed in to change notification settings - Fork 7
/
tracks2mp3.pl
47 lines (41 loc) · 1.15 KB
/
tracks2mp3.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
use strict ;
use warnings ;
open(my $fh, "<tracks.dat") ;
sub filename_encode($)
{
my $in = shift ;
$in =~ s/\'//g ;
$in =~ s/\"//g ;
$in =~ s/\,//g ;
$in =~ s/ /_/g ;
return $in ;
}
sub cmd_encode($)
{
my $in = shift ;
#$in =~ s/\'/\\'/g ;
return "\"$in\"" ;
}
my $skip=0 ;
while(<$fh>) {
chomp ;
my ($file,$artist,$album,$title) = split(',') ;
print "File:$file\nArtist:$artist\nTitle:$album: $title\n" ;
my $ftitle = filename_encode($title) ;
my $ctitle = cmd_encode($title) ;
my $cartist = cmd_encode($artist) ;
my $calbum = cmd_encode($album) ;
my $cmd = "lame -h -V 5 --tt $ctitle --ta $cartist --tl $calbum $file ${ftitle}.mp3" ;
print "$cmd\n" ;
system "$cmd\n" if $skip > 0 ;
$skip++ ;
}
__END__
track02.cdda.wav,Michael Johnson,This Night Won't Last Forever
track04.cdda.wav,Michael Johnson,Bluer Than Blue
track06.cdda.wav,Michael Johnson,That's That
track10.cdda.wav,Karla Bonoff,All My Life
track12.cdda.wav,Karla Bonoff,Someone To Lay Down Beside Me
track14.cdda.wav,Karla Bonoff,Personally
track16.cdda.wav,Karla Bonoff,Wild Heart of The Young
track18.cdda.wav,Karla Bonoff,Home