Customizing file name generation - nu774/qaac GitHub Wiki

qaac automatically generates output filename based on input filenames, or tags. In case of cuesheet input without --concat, tags are always used. Otherwise, input filename is used by default. You can use --fname-from-tag option to force tag based filename generation.

Using additional --fname-format option, you can customize filename generation.

By default (if you don't specify --fname-format option), format "${tracknumber}${title& }${title}" is applied, and this results in a file named like "01 A Hard Day's Night.m4a". You must feed file name part(before extension) only. ".m4a" is automatically added by qaac, according to other options.

Syntax of format string for --fname-format is as follows.

  1. Basically, characters in the format string evaluates to itself. That is, if you specify --fname-format foo, every file will be named like "foo.m4a" (though this would not what you want).
  2. ${tag} evaluates to tag's value. For example, ${artist} becomes "The Beatles".
  3. ${tag&word} has a special meaning. If tag is present and it's value is not empty, it evaluates to word. Otherwise, it evaluates to tag's value (i.e. empty string). You can think of this as operator && (and) in programming languages. You can nest ${} inside of word.
  4. ${tag|word} has a special meaning, too. If tag is present and it's value is non-empty, it evaluates to tag's value. Otherwise, it evaluates to word. You can think of this as operator || (or) in programming languages. You can nest ${} inside of word. For example, ${albumartist|${artist}} evaluates to album artist if it is non empty, otherwise it evaluates to artist.

Now I can explain the meaning of the default.

  1. "${tracknumber}" evaluates to track number.
  2. "${title& }" evaluates to " " (a white space) if title tag is present, else it evaluates to empty string.
  3. "${title}" evaluates to title tag's value.

That is, if title is present, the file will be named like "01 A Hard Day's Night.m4a" as I have said. Otherwise, it will be like "01.m4a".
You want a delimiter between track number and song title, but when title tag is not present or empty, you don't want to get "01 .m4a" (a white space before ".m4a").
${title& } is necessary for this reason, instead of just using "${tracknumber} ${title}" (a literal white space between two tags).

Of course, when you are certain of having non empty entries in your cue sheet, you won't need this kind of tricky craps.

You can use the following tag names. Only "tracknumber" will be always present in case of cuesheet, and formatted in two digit, zero padded. Others depend on your cuesheet. Names are different from cue sheet element name. However, the meaning should be self explanatory.

title
artist
albumartist
album
composer
genre
date
tracknumber
⚠️ **GitHub.com Fallback** ⚠️