Add global search, add reset all audiobooks

This commit is contained in:
advplyr 2021-08-21 16:23:35 -05:00
parent fb0a6f4ec2
commit f70e1beca1
18 changed files with 323 additions and 33 deletions

View file

@ -28,6 +28,12 @@ class Db {
return this.settingsDb
}
getEntityDbKey(entityName) {
if (entityName === 'user') return 'usersDb'
else if (entityName === 'audiobook') return 'audiobooksDb'
return 'settingsDb'
}
getEntityArrayKey(entityName) {
if (entityName === 'user') return 'users'
else if (entityName === 'audiobook') return 'audiobooks'
@ -155,6 +161,18 @@ class Db {
})
}
recreateAudiobookDb() {
return this.audiobooksDb.drop().then((results) => {
Logger.info(`[DB] Dropped audiobook db`, results)
this.audiobooksDb = new njodb.Database(this.AudiobooksPath)
this.audiobooks = []
return true
}).catch((error) => {
Logger.error(`[DB] Failed to drop audiobook db`, error)
return false
})
}
getGenres() {
var allGenres = []
this.db.audiobooks.forEach((audiobook) => {