mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-08-31 23:20:05 +02:00
New data model migration for users, bookmarks and playback sessions
This commit is contained in:
parent
4c2ad3ede5
commit
68b13ae45f
17 changed files with 462 additions and 192 deletions
|
@ -646,31 +646,6 @@ class Scanner {
|
|||
}
|
||||
}
|
||||
|
||||
// TEMP: Old version created ids that had a chance of repeating
|
||||
async fixDuplicateIds() {
|
||||
var ids = {}
|
||||
var audiobooksUpdated = 0
|
||||
for (let i = 0; i < this.db.audiobooks.length; i++) {
|
||||
var ab = this.db.audiobooks[i]
|
||||
if (ids[ab.id]) {
|
||||
var abCopy = new Audiobook(ab.toJSON())
|
||||
abCopy.id = getId('ab')
|
||||
if (abCopy.book.cover) {
|
||||
abCopy.book.cover = abCopy.book.cover.replace(ab.id, abCopy.id)
|
||||
}
|
||||
Logger.warn('Found duplicate ID - updating from', ab.id, 'to', abCopy.id)
|
||||
await this.db.removeEntity('audiobook', ab.id)
|
||||
await this.db.insertAudiobook(abCopy)
|
||||
audiobooksUpdated++
|
||||
} else {
|
||||
ids[ab.id] = true
|
||||
}
|
||||
}
|
||||
if (audiobooksUpdated) {
|
||||
Logger.info(`[Scanner] Updated ${audiobooksUpdated} audiobook IDs`)
|
||||
}
|
||||
}
|
||||
|
||||
async quickMatchBook(libraryItem, options = {}) {
|
||||
var provider = options.provider || 'google'
|
||||
var searchTitle = options.title || libraryItem.media.metadata.title
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue