ifeatu has asked for the wisdom of the Perl Monks concerning the following question:

Hello, Im relatively new to Perl and I want to use Perl to write a simple script that takes a file name and chops it up and puts the contents into the meta tag of the file it came from (mp3). eg Filename: Jan_03_1991_The_Sufferings_of_Christ_BLH_Side_1.mp3 MetaTags: Year: 1991 Album Name (In this order): 1991-01-03- The_Sufferings_of_Christ -BLH Track Number: 1 So I installed the Perl mod from cpan for mp3::tag ID3 but have no idea how to begin to use it. Can anyone help?

Replies are listed 'Best First'.
Re: Perl mod for MP3 tags
by almut (Canon) on Dec 05, 2009 at 04:37 UTC
    ...but have no idea how to begin to use it.

    In case of doubt, start with looking at the synopsis in the module's docs, and - to begin to play around with it - cut-n-paste appropriate parts of it into where you want to edit your new script.

    Then, read a bit further down in the docs to find methods that might help with creating/writing tags, which is what you want to do.  Having found the method new_tag(), grep the examples directory that comes with the tarball for snippets that might help clarify the usage of the method.  This finds tagged.pl and tagit.pl as candidates to take a closer look at...

    Once you can write sample tags with content like "foo", "bar" etc., approach the next step, i.e. look into how to get the appropriate info out of the filename... Hope you get the idea :)

    And, of course, in case you should get stuck, feel free to post the code you have so far...

Re: Perl mod for MP3 tags
by marto (Cardinal) on Dec 05, 2009 at 10:35 UTC

    In addition to the advice you've already been given, check out the examples directory.

    Martin