Audiobooks and Track/Disk Number

Started by wesley, November 01, 2021, 01:52:15 PM

Previous topic - Next topic

wesley

I use Exiftool to rename and apply directories to my audiobooks like so.

for f in $FILES
do
  echo "Processing $f file..."
  echo "exiftool '-filename<$Artist/$Title/$Artist-$Title.%e' $f"
  # take action on each file. $f store current file name
  exiftool '-filename<$Artist/$Title/$Artist-$Title.%e' $f
done

but Audiobook are generally a single track and disk, but those fields are always empty. is there a way to add TRACKNUMBER='01' and DISKNUMBER='01' to my loop?

StarGeek

First of all, you should not be looping exiftool, this is Common Mistake #3 and will significantly increase the processing time.  Just pass the directory straight to exiftool, using the -r (-recurse) option and -ext (-extension) option to control the files processed.  Or if your search is more complex, save the file list to a temp file and read the temp file with the -@ (Argfile) option.

Quote from: wesley on November 01, 2021, 01:52:15 PM
but Audiobook are generally a single track and disk, but those fields are always empty. is there a way to add TRACKNUMBER='01' and DISKNUMBER='01' to my loop?

To the file name or directly to the file?  If the file name, just put the values where you want.

If you want to add these to the file, maybe, but probably not.  If the track/disk numbers are held in an ID3 block, such as in an FLAC or MP3, then no, because exiftool can't edit those.  If it's an M4B or M4A, then exiftool can add it to the Quicktime tags, TrackNumber and DiskNumber with -TrackNumber=1 -DiskNumber=1.  But any other program you're using to look at the data may not read those, instead looking for an ID3 block.  You'll have to test it out and see.  Use FAQ #3 on a file that already shows a correct track/disk number in any other program you're using.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

wesley

root@Eyrie:~# exiftool -TrackNumber=1 -DiskNumber=1 TestFile2.m4a
Warning: Error converting value for ItemList:DiskNumber (ValueConvInv)
Error: File not found - TestFile2.m4a
    0 image files updated
    1 files weren't updated due to errors

The Track Change doesn't seem to do anything.

Phil Harvey

The command didn't do anything because the file was not found.  Try dragging and dropping the M4A file onto the terminal window instead of typing the name.

Your command worked fine for me to write both TrackNumber and DiskNumber using ExifTool 12.36.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

wesley

sign.....

Nothing like releasing you've wasted someone else's time before noticing that you are down a level.

Thanks for pointing me to my error.  :)