Home > pretag

pretag

Pretag is a project mainly written in ..., it's free.

Perl Regular Expression [ID3] Tag [Tool]

PRETag (or Perl Regular Expression [ID3] Tag [Tool]) allows you to tag your MP3 files using Perl regular expressions. Who would have thought! Run with -h for all the information you need, including examples.

For your convencience, I've pasted the output of pretag -h here so you don't have to install it to see if it is what you're looking for.


Usage: /home/jkramer/scripts/pretag <-p pattern> [optional stuff] [bunch of MP3 files]

-p | --pattern= Looking at the usage line above, you might have thought, "hey, -p is the only non-optional argument, so it must be important," and you're right! This whole script is about that pattern, because it lets us gather track information from file names using a regular expression. This is why you need to know (Perl) regular expressions to use this tool. The wanted information is extracted from the file names using "named groups" or "named capture buffers". Check perlre(1pm) and the examples below for details.

-v | --verbose Print lots of information about what's going on.

-h | --help Print this help text and quit.

-d | --dry-run Don't actually do anything (only useful with -v to see what would be done if you had not used -d).

-c | --title-case Try to fix the title case of found tags.

-N | --noise= Use this to define a regular expression that matches characters and strings considered line noise. E.g., some people think it's funny to distribute files like this "09-bloodhoundgang-_the_ballad_of_chaseylain-ysp.mp3"; use "-N '|-ysp'" to fix it.

-z | --zero-pad= Use this to fill the track number with zeros to the given width. For example, the original track number 1 would become 001 with -z 3. Only affects the generated file name (when -r is given), not the ID3 tag.

-r | --rename= Rename the file using the given file name format. The format should like this: " - - .mp3" - guess I see the pattern. Just put any of the long tag option names between <> and it will be replaced with the corresponding tag data.</p> <p>-u | --update Update the MP3 files ID3 tags with the information captured from the file name and/or defined as command line argument.</p> <p>Note: Even if you have specified a tag in your regular expression, if you also define the tag using one of the options below, it will override the one found in the file name.</p> <p>-a <artist> | --artist=<artist> Override artist.</p> <p>-l <album> | --album=<album> Override album.</p> <p>-t <title> | --title=<title> Override title (sometimes called song name).</p> <p>-n <track-number> | --track=<track-number> Override track number.</p> <p>-y <year> | --year=<year> Override release year.</p> <p>-o <comment> | --comment=<comment> Override comment.</p> <p>-g <genre> | --genre=<genre> Override genre</p> <p>Examples</p> <p>Assuming you pirated the album "Back on the Streets" by 88 Fingers Louie somehow (don't do that, it's illegal!), but the ID3 tags are in bad shape and you don't like the file names because they look like this:</p> <p>[01] - 88 fingers louie - tomorrow starts today.mp3 [02] - 88 fingers louie - selfish means.mp3 ...</p> <p>Then you might try this.</p> <p>/home/jkramer/scripts/pretag -p '^[(?<track>d+)] - (?<artist>.<em>?) - (?<title>.</em>).mp3$' -l 'Back on the Streets' -c -u -y 1998 -g 'Hardcore' *.mp3</p> <p>Adding -v, the script would print something like this:</p> <p>[01] - 88 fingers louie - tomorrow starts today.mp3: Artist: 88 Fingers Louie Album: Back on the Streets Title: Tomorrow Starts Today Track: 01 Year: 1998 Genre: Hardcore Comment: Writing tags for [01] - 88 fingers louie - tomorrow starts today.mp3. ...</p> <p>Use -r to rename files using the freshly detected meta data.</p> <p>For example, add this to the command above:</p> <p>... -z 2 -r '<track> - <title>.mp3'</p> <p>This will rename the file in the example above from '[01] - 88 fingers louie - tomorrow starts today.mp3' to '01 - Tomorrow Starts Today.mp3'.</p> </div> </div> </div> <div class="col-sm-10 col-sm-offset-1" style="margin-top: 1px;"> <div class="listBlocks content_box"> <div class="pre_next_box"> <div class="pre_next"><div class="pre"><span>Previous:</span><a href="//osphub.com/underdark/" title="Underdark">Underdark</a></div><div class="next"><span>Next:</span><a href="//osphub.com/dcsobral-puppet-postgres/" title="puppet-postgres">puppet-postgres</a></div></div> </div> </div> </div> </div> <!-- <div class="simle_box300"></div> --> </div> </section> <div class="footer-wrapper"> <div class="footer"> <p class="text-center"> ©2024 OSPHUB.COM </p> </div> </div></body> </html>