PreshBlog

Retagging audio tracks based on filename

by on Jan.31, 2009, under Perl, Programming

I had some audio tracks which weren’t tagged, but did have filenames containing the artist, title etc, so I whipped up a quick Perl script to sort them out – retag-by-filename.pl.

It takes a regular expression with named captures for track, title, artist and comment, and sets the tgs on the file as appropriate.

It makes use of Music::Tag to do the actual tagging and Getopt::Lucid to read the options supplied, and requires Perl 5.10.0 for named regex captures (and ‘say’).

A --dry-run option allows you to check that the filenames are being parsed correctly by your regex before actually writing tags.

See retag-by-filename.pl for the full details.


5 Comments for this entry

  • Warren

    Well I have so many mp3 files than now I do not care about them. I just select my favourite ones and store them in some different folder and use them and whenever I format my machine I never took those folders except my favourite ones.

    Managing music files is really a waste of time. But thanks to you that you have got the solution for this.

  • nicole

    yup, so many music files is quite headache, better only keep those that you like and delete off all those you seldom listen one.

  • wamu

    I have many mp3 file, it is hard to arrange or format. some I want to listen anymore, some I want to delete. when I format them, all of them will be lost from my mp3 play station

  • コンタクトレンズ

    Old files are really burden to me. I am not able to delete them as I think that this can have some useful data and storing them and looking at them is always waste of time.

    I am planning to buy an external hard disk and will save these unwanted music files and other files at there.

    What do you think ?

  • bigpresh

    @”River Plac Austin TX” – space isn’t the issue, properly tagged files are.

    Disc space is so cheap these days, there’s no need to delete anything that you’d rather keep :)

Leave a Reply

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!