https://www.audiobookshelf.org/docs/#bo ... -structure
I used the FileBot article here to begin building something that align to their standards:
viewtopic.php?t=14137
I've went through a ton of scripts and attempts, but this is what generally works:
Format: Select all
{ drive }/Audiobooks/
{
def query = fn.space(' ').removeAll(/^\d+ - | - \d+$| \d+$|-Part\d+$/)
def url = 'https://www.audible.com/search'.toURL(keywords: query, ipRedirectOverride: true, overrideBaseCountry: true)
def ul = html(url).select('li.authorLabel').first().parent()
def title = ul.select('h3 a').text()
def author = ul.select('li.authorLabel a').text()
def narrator = ul.select('li.narratorLabel a').text()
def series = ul.select('li.seriesLabel a').text()
def book = any { ul.select('li.seriesLabel').text().tokenize().last() } { null }
def trackNumber = String.format('%02d', i )
// Define file extensions
def nonAudioExtensions = ['jpg', 'jpeg', 'nfo']
def audioExtensions = ['mp3', 'm4b', 'flac']
if (nonAudioExtensions.contains(ext.toLowerCase())) {
// Copy non-audio files without renaming
if (series) {
return "$author/$series/Book $book - $title {$narrator}/Book $book $title {$narrator}"
} else {
return "$author/$title {$narrator}/${fn}"
}
} else {
// Default behavior for audio files
if (series) {
return "$author/$series/Book $book - $title {$narrator}/Book $book - $title {$narrator} ${trackNumber}.${ext}"
} else {
return "$author/$title {$narrator}/$title {$narrator} ${trackNumber}.${ext}"
}
}
}

I can't figure out how to either 1) have the audio files begin numbering at 01, or 2) have filebot retain the file numbers that exist (although not all audio books will have a number in the same format cleanly at the end).
The only way I've been able to "fix" this is to exclude anything other than audiofiles. Then it will start the numbering at 01.
Any idea how I can fix this? I embarrassed to admit how long I've tried on this today.