mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-07-08 00:15:03 +02:00
Add global search, add reset all audiobooks
This commit is contained in:
parent
fb0a6f4ec2
commit
f70e1beca1
18 changed files with 323 additions and 33 deletions
18
server/Db.js
18
server/Db.js
|
@ -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) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue