|Welcome to the Monastery|
Re: Plenty of Practical Perl Problems?by hawtin (Prior)
|on Jul 25, 2007 at 09:17 UTC||Need Help??|
I use Perl to manipulate my music collection. I have scripts that validate MP3 tags, convert between formats, re-tag mp3 files as they copy them to diferent players etc.
My reasons for using Perl in this case are that there are lots of things I want to do, my processing time is close to infinite but my development time is very limited.
I have long suspected that these type of issues would be a good way to discuss many of the key Perl skills (data manipulation, controlling other programs etc) in a context that is both interesting to most people and slightly away from "work".
Validate MP3 Tags
When I get a new CD I rip it in FLAC and save the data. Once I have more than 4Gb I create an index file (with a Perl script) and write it to a DVD. In the meantime I create a 128kB MP3 and tag it using public tools. The issue is that the artist names are not consistent and the year field is almost never set, so I have a Perl script that checks the tags for consistency and works out the year.
I then have a Perl script that places the new tracks in my "on-line" set (on the house DAAP server), it takes care of transferring to the dedicated machine and making sure the server can see it.
These tasks are all implemented by combinations of CPAN modules and system() calls to existing programs (for example I use lame to encode mp3s).
Different Portable Players
The family have a number of different MP3 players, each of which has its own strange behaviour. I have a Perl script that, once you have selected which player you have, may convert the format (for example to 64kB MP3 for the older players with limited capacity) and retag.
I have one player in particular that either plays the tracks in order of creation, or in alphabetical order of track name. If the album needs to be played in the right order the transfer program prepends the track number to the trackname tag (so it becomes, for example "a01 - Grace Kelly") and playing the tracks in alphabetical order works.
I also have a collection of music charts which are consolidated in Perl to create the web site http://www.tsort.info/music/ (that is how I can assign the years to mp3 tracks).