mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-08-02 17:24:57 +02:00
Update Series and Author model to be library specific
This commit is contained in:
parent
1d13d0a553
commit
0ac63b2678
10 changed files with 119 additions and 61 deletions
|
@ -519,7 +519,7 @@ class ApiRouter {
|
|||
return listeningStats
|
||||
}
|
||||
|
||||
async createAuthorsAndSeriesForItemUpdate(mediaPayload) {
|
||||
async createAuthorsAndSeriesForItemUpdate(mediaPayload, libraryId) {
|
||||
if (mediaPayload.metadata) {
|
||||
const mediaMetadata = mediaPayload.metadata
|
||||
|
||||
|
@ -534,10 +534,10 @@ class ApiRouter {
|
|||
}
|
||||
|
||||
if (!mediaMetadata.authors[i].id || mediaMetadata.authors[i].id.startsWith('new')) {
|
||||
let author = Database.authors.find(au => au.checkNameEquals(authorName))
|
||||
let author = Database.authors.find(au => au.libraryId === libraryId && au.checkNameEquals(authorName))
|
||||
if (!author) {
|
||||
author = new Author()
|
||||
author.setData(mediaMetadata.authors[i])
|
||||
author.setData(mediaMetadata.authors[i], libraryId)
|
||||
Logger.debug(`[ApiRouter] Created new author "${author.name}"`)
|
||||
newAuthors.push(author)
|
||||
}
|
||||
|
@ -563,10 +563,10 @@ class ApiRouter {
|
|||
}
|
||||
|
||||
if (!mediaMetadata.series[i].id || mediaMetadata.series[i].id.startsWith('new')) {
|
||||
let seriesItem = Database.series.find(se => se.checkNameEquals(seriesName))
|
||||
let seriesItem = Database.series.find(se => se.libraryId === libraryId && se.checkNameEquals(seriesName))
|
||||
if (!seriesItem) {
|
||||
seriesItem = new Series()
|
||||
seriesItem.setData(mediaMetadata.series[i])
|
||||
seriesItem.setData(mediaMetadata.series[i], libraryId)
|
||||
Logger.debug(`[ApiRouter] Created new series "${seriesItem.name}"`)
|
||||
newSeries.push(seriesItem)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue