Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

Re: rename 0.3 - now with two extra cupholders

by sauoq (Abbot)
on Nov 01, 2003 at 23:03 UTC ( #303852=note: print w/replies, xml ) Need Help??

in reply to rename 0.3 - now with two extra cupholders

(PodMaster informs me that it's only included in ActivePerl. I haven't looked.)

I was going to claim this was incorrect, but then I checked. It seems it has been removed sometime since 5.6.1. (It used to be in the eg/ directory.) That's too bad, imho.

While you are blue-skying... and I really like the idea for MP3 handling... I think that the ID3 tag support should be provided by a separate module. (Maybe MP3::ID3Lib? That's not a recommendation, just a pointer.) If the module is not available and the user tries to use the ID3 related options, it should die with an error.

Not only does it make sense to leave out ID3 specific code from a general rename script, but designing it like this might also allow you to add special support for other file formats. For instance, I'd personally love support for using EXIF data in jpegs extracted via Image::EXIF or similar. (Again, not a recommendation; just a pointer.)

On a related note, it seems Johan Vromans has an mp3rename script on CPAN that uses ID3 tag info. Maybe it'll be helpful to look at it.

"My two cents aren't worth a dime.";
  • Comment on Re: rename 0.3 - now with two extra cupholders

Replies are listed 'Best First'.
Re^2: rename 0.3 - now with two extra cupholders
by Aristotle (Chancellor) on Nov 02, 2003 at 11:32 UTC

    I know, I've seen it before. It's very limited though.

    I think that the ID3 tag support should be provided by a separate module.

    My thoughts exactly, though I was thinking of MP3::Info. The idea is to have an --mp3 switch require the module at runtime, then have code that provides the information from the ID3 tag in variables like $ARTIST etc. Afterwards they're checked for changes just like $_ is. Assuming you have names like 02 Falling.mp3 you could then do something like

    rename --mp3 '$_="\L\u$ARTIST/\u$ALBUM\E/$_"; $TRACK=0+((/^(\d+)/)[0]) +' -z *

    and have it end up in Spicelab/A_day_on_our_planet/02_Falling.mp3 with its ID3 tracknumber set properly.

    Adding similar mechanism for EXIF data would be simple (and a good idea too - I didn't think of EXIF, thanks!).

    Makeshifts last the longest.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://303852]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (5)
As of 2023-06-01 08:18 GMT
Find Nodes?
    Voting Booth?

    No recent polls found