Catalina deleted all my Audiobooks!

From Wurst-Wasser.net
Jump to navigation Jump to search

What? It deleted all the Audiobooks? No, not really. But hid them well and left it to me to remedy the situation.

The Problem

Upgrading from Mojave to Catalina was mostly harmless. Fitting for an earth-made OS. :-) At some time (I guess it was opening Books), Catalina tried to move all my Audiobooks from iTunes (now Music) to iBooks (now Books). Since my iTunes Library is on an USB-drive, and the iBooks-Library is on the internal SSD (with obviously less space) this failed. That wouldn't be so bad, if the AudioBooks where still usable in iTunes.

The Analysis

  • Q: Are they still in iTunes?
  • A: Can't find them in Music-App.
  • Q: Have the files been left over?
  • A: Try find . -name \*.aa\* -print in your Music/iTunes Library. In my case, it found all my Audible-Audiobooks (.aa)

So, they are still there...

The Solution

What doesn't work #1

CatalinaBooksMusic01.png CatalinaBooksMusic02.png This is really annoying. This stupid app doesn't even tell me how much I should free. Absolutely useless.

What doesn't work #2

$ ln -s /Volumes/Daten\ HD\ \(Portable\ Samsung\ 2TB\)/Users/SOMEONE/Music/Audiobooks/Audiobooks /Users/SOMEONE/Library/Containers/com.apple.BKAgentService/Data/Documents/iBooks/Books/

Alias doesn't work, too![1]

What worked for me

For the moment, I decided to salvage only the Audiobooks from Audible (386 files of the 13,500 in total), and let the rest stay in the iTunes Library. Why, you ask? It's pretty simple. I added loads of kid's CDs to my iTunes Library, so the kids can play them on iPod Touches instead of CD-Players. Now the but: GracenoteDB and similar services come in handy when adding CDs, but...one CD can have more than one artist (worst case, another for each track), iTunes sorts (more like "spreads") the contents of the CD in multiple Artist-Folders in iTunes Library...(read on, I found a solution later on)


The easy part: Extract all Audible Audiobooks

This script will move all Audible Audiobooks to another location. From there, you can add them (as needed) to Books.

#!/bin/bash
#set -x

GITUNESLIB="/Volumes/Daten HD (Portable Samsung 2TB)/Users/SOMEONE/Music/iTunes/iTunes Music"
GTARGETFOLDER="/Volumes/Daten HD (Portable Samsung 2TB)/Audiobooks Salvaged After Catalina-Fuckup"
GEXTENSIONS=".aa" # m4b=Apple, aa=Audible
#GEXTENSIONS=".m4b .aa" # m4b=Apple, aa=Audible

# Find Audiobooks
for EXT in ${GEXTENSIONS}; do
	echo "Searching for \"${EXT}\"..."
	find "${GITUNESLIB}" -name \*${EXT}\* -print | while read LINE; do
		echo "Found: $LINE"
        	BOOK="`echo \"${LINE}\" | rev|cut -d/ -f2 | rev`"
        	ARTIST="`echo \"${LINE}\" | rev|cut -d/ -f3 | rev`"
#         	echo "Book: $BOOK"
#		echo "Artist: $ARTIST"

		# Create Parent Folders
		mkdir -p "${GTARGETFOLDER}/${ARTIST}/${BOOK}"

		# Move Audiobook 
		mv "${LINE}" "${GTARGETFOLDER}/${ARTIST}/${BOOK}/"
	done # done find
done # done extensions

# EOF

The hard part: Extracting all Other Audiobooks

I tried different approaches, but ended up with the most obvious:

  • Mount the disk containing the iTunes Library on a VM with Mojave[2][3][4]
  • Use good, old iTunes to export the Audiobooks using a Script I originally developed for AppleScript Launcher[5]
    • Create a (Smart) Playlist with all the Audiobooks to export
    • Select all items
    • run Export Selected Tracks….applescript[6]<ref>You can also use drag&drop, but then you don't have a nice sorting like you get with the AppleScript
    • Optional: Delete the exported items from your Library
    • Optional: Also use this Script for the before mentioned Audible-Content

More on that matter...


Footnotes:

  1. Tried everything I could think of: restarting BKA-Daemon, rebooting...Nothing worked.
  2. I recommend VMWare Fusion 11.x.
  3. Download Mojave: https://support.apple.com/en-us/HT210190 <- there's an AppStore-Link in the Article
  4. Somehow mounting didn't work. But sharing the Music Folder did.
  5. This could also be done with bash and mp3info, but the grouping and Metadata of iTunes are more accurate.
  6. AppleScript: Export Selected Tracks….applescript