Posted by Holger Schauer in
Linux, Programming
Friday, August 10. 2007
I love the Unix toolbox:
[elendil->Get_the_gore]mp3info -p "%S\t%m:%02s\t%t\n" * | perl -ne '{ $time=$time+$1 if (/^(\d+)[ \t]+(.*)$/); print $2."\n"; } END { print "Total seconds: $time\n"; $min=$time/60; $secs=$time%60; print(sprintf("Total time: %d:%d\n",$min,$secs)); }'
2:10 Fox in a box
3:16 Loaded heart
2:53 All grown up
3:07 Pleasure unit
2:51 Where evil grows
3:16 Casino
2:38 Don't cry
2:24 Mary Ann
3:48 You lied to me before
1:50 So sophisticated
2:50 Little baby
2:44 Sweet potato
2:56 Voodoo doll
1:51 Hammer stomp
Total seconds: 2314
Total time: 38:34
Printing out the track number and the track title works only if the file contains an ID3 tag, of course.