mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-01-04 21:20:09 +01:00
Fix db migration
This commit is contained in:
parent
5ff4cd2c0b
commit
755e70b4a9
@ -54,7 +54,6 @@ class Book {
|
|||||||
tags: [...this.tags],
|
tags: [...this.tags],
|
||||||
audiobooks: this.audiobooks.map(ab => ab.toJSONMinified()),
|
audiobooks: this.audiobooks.map(ab => ab.toJSONMinified()),
|
||||||
ebooks: this.ebooks.map(eb => eb.toJSONMinified()),
|
ebooks: this.ebooks.map(eb => eb.toJSONMinified()),
|
||||||
duration: this.duration,
|
|
||||||
size: this.size
|
size: this.size
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -66,22 +65,14 @@ class Book {
|
|||||||
tags: [...this.tags],
|
tags: [...this.tags],
|
||||||
audiobooks: this.audiobooks.map(ab => ab.toJSONExpanded()),
|
audiobooks: this.audiobooks.map(ab => ab.toJSONExpanded()),
|
||||||
ebooks: this.ebooks.map(eb => eb.toJSONExpanded()),
|
ebooks: this.ebooks.map(eb => eb.toJSONExpanded()),
|
||||||
duration: this.duration,
|
|
||||||
size: this.size,
|
size: this.size,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
get tracks() {
|
|
||||||
return this.audioFiles.filter(af => !af.exclude && !af.invalid)
|
|
||||||
}
|
|
||||||
get duration() {
|
|
||||||
var total = 0
|
|
||||||
this.tracks.forEach((track) => total += track.duration)
|
|
||||||
return total
|
|
||||||
}
|
|
||||||
get size() {
|
get size() {
|
||||||
var total = 0
|
var total = 0
|
||||||
this.audioFiles.forEach((af) => total += af.metadata.size)
|
this.audiobooks.forEach((ab) => total += ab.size)
|
||||||
|
this.ebooks.forEach((eb) => total += eb.size)
|
||||||
return total
|
return total
|
||||||
}
|
}
|
||||||
get hasMediaEntities() {
|
get hasMediaEntities() {
|
||||||
|
@ -3,12 +3,13 @@ const fs = require('fs-extra')
|
|||||||
const njodb = require("njodb")
|
const njodb = require("njodb")
|
||||||
|
|
||||||
const { SupportedEbookTypes } = require('./globals')
|
const { SupportedEbookTypes } = require('./globals')
|
||||||
|
const { getId } = require('./index')
|
||||||
|
const Logger = require('../Logger')
|
||||||
|
|
||||||
const LegacyAudiobook = require('../objects/legacy/Audiobook')
|
const LegacyAudiobook = require('../objects/legacy/Audiobook')
|
||||||
const UserAudiobookData = require('../objects/legacy/UserAudiobookData')
|
const UserAudiobookData = require('../objects/legacy/UserAudiobookData')
|
||||||
|
|
||||||
const LibraryItem = require('../objects/LibraryItem')
|
const LibraryItem = require('../objects/LibraryItem')
|
||||||
|
|
||||||
const Logger = require('../Logger')
|
|
||||||
const Book = require('../objects/mediaTypes/Book')
|
const Book = require('../objects/mediaTypes/Book')
|
||||||
|
|
||||||
const BookMetadata = require('../objects/metadata/BookMetadata')
|
const BookMetadata = require('../objects/metadata/BookMetadata')
|
||||||
@ -64,7 +65,7 @@ function makeAuthorsFromOldAb(authorsList) {
|
|||||||
var newAuthor = new Author()
|
var newAuthor = new Author()
|
||||||
newAuthor.setData({ name: authorName })
|
newAuthor.setData({ name: authorName })
|
||||||
authorsToAdd.push(newAuthor)
|
authorsToAdd.push(newAuthor)
|
||||||
Logger.info(`>>> Created new author named "${authorName}"`)
|
Logger.debug(`>>> Created new author named "${authorName}"`)
|
||||||
return newAuthor.toJSONMinimal()
|
return newAuthor.toJSONMinimal()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user