9.11 Tagging Automatically Audio Files

20190821 To add metadata from the file name into the metadata information within the file the lltag command comes in handy. In this first example, the track and title is extracted from the filename, assuming a filename is something like 01_paradise_today.mp3, with the title capitalised:

$ lltag --dry-run --format %n_%t --sep _ --maj *.mp3

The -{-maj} converts the words of the title to uppercase first letter.

Another example, including an artist, and with blanks in the filename, might be consructed to deal with a file name like: '01 Bruno Simpson - Major Trouble.mp3':

$ lltag --format "%n %a - %t" --maj *.mp3

Each command will ask for confirmation each time.

To automatically rename files to match our proposed file naming scheme introduced in Section ??, for files based on the mp3 tags use lltag:

$ lltag * --mp3v2 --dry-run --yes --rename "%n_%t" --rename-min \
          --rename-sep _ --rename-regexp "s/[\'\(\)]/_/"

Notice the use of --dry-run so that we can first check it will be doing the right thing before we actually rename the files.



Your donation will support ongoing development and give you access to the PDF version of this book. Desktop Survival Guides include Data Science, GNU/Linux, and MLHub. Books available on Amazon include Data Mining with Rattle and Essentials of Data Science. Popular open source software includes rattle, wajig, and mlhub. Hosted by Togaware, a pioneer of free and open source software since 1984. Copyright © 1995-2021 Graham.Williams@togaware.com Creative Commons Attribution-ShareAlike 4.0.