Go to TogaWare.com Home Page. GNU/Linux Desktop Survival Guide
by Graham Williams
Duck Duck Go

Automatic Tagging Tools

20190821 Suppose we have an audio file and want to add metadata from the file name into the metadata information within the file. In this first example, the track and title is extracted from the filename, assuming a filename is something like 01_paradise_today.mp3:

$ lltag --format %n_%t --sep _ --maj *.mp3
--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 8.1, 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.

Copyright © 1995-2020 Togaware Pty Ltd
Support further development through the purchase of the PDF version of the book.
Brought to you by Togaware and the author of open source software including Rattle and wajig.
Also the author of Data Mining with Rattle and Essentials of Data Science.