Fix scan for audiobook directories in root dir

This commit is contained in:
advplyr 2021-08-23 14:08:54 -05:00
parent 5ecfaa88c2
commit a93f409dcd
11 changed files with 157 additions and 11 deletions

View file

@ -39,13 +39,15 @@ async function getAllAudiobookFiles(abRootPath) {
var pathformat = Path.parse(relpath)
var path = pathformat.dir
// If relative file directory has 3 folders, then the middle folder will be series
var splitDir = pathformat.dir.split(Path.sep)
if (splitDir.length === 1) {
Logger.error('Invalid file in root dir', filepath)
if (!path) {
Logger.error('Ignoring file in root dir', filepath)
return
}
var author = splitDir.shift()
// If relative file directory has 3 folders, then the middle folder will be series
var splitDir = pathformat.dir.split(Path.sep)
var author = null
if (splitDir.length > 1) author = splitDir.shift()
var series = null
if (splitDir.length > 1) series = splitDir.shift()
var title = splitDir.shift()