mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-01-07 11:39:38 +00:00
Merge master
This commit is contained in:
commit
ab14b561f5
147 changed files with 4669 additions and 5036 deletions
|
|
@ -211,6 +211,32 @@ class Book extends Model {
|
|||
}
|
||||
}
|
||||
|
||||
getAbsMetadataJson() {
|
||||
return {
|
||||
tags: this.tags || [],
|
||||
chapters: this.chapters?.map(c => ({ ...c })) || [],
|
||||
title: this.title,
|
||||
subtitle: this.subtitle,
|
||||
authors: this.authors.map(a => a.name),
|
||||
narrators: this.narrators,
|
||||
series: this.series.map(se => {
|
||||
const sequence = se.bookSeries?.sequence || ''
|
||||
if (!sequence) return se.name
|
||||
return `${se.name} #${sequence}`
|
||||
}),
|
||||
genres: this.genres || [],
|
||||
publishedYear: this.publishedYear,
|
||||
publishedDate: this.publishedDate,
|
||||
publisher: this.publisher,
|
||||
description: this.description,
|
||||
isbn: this.isbn,
|
||||
asin: this.asin,
|
||||
language: this.language,
|
||||
explicit: !!this.explicit,
|
||||
abridged: !!this.abridged
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize model
|
||||
* @param {import('../Database').sequelize} sequelize
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ const oldLibrary = require('../objects/Library')
|
|||
* @property {string} autoScanCronExpression
|
||||
* @property {boolean} audiobooksOnly
|
||||
* @property {boolean} hideSingleBookSeries Do not show series that only have 1 book
|
||||
* @property {string[]} metadataPrecedence
|
||||
*/
|
||||
|
||||
class Library extends Model {
|
||||
|
|
@ -79,6 +80,9 @@ class Library extends Model {
|
|||
mediaType: libraryExpanded.mediaType,
|
||||
provider: libraryExpanded.provider,
|
||||
settings: libraryExpanded.settings,
|
||||
lastScan: libraryExpanded.lastScan?.valueOf() || null,
|
||||
lastScanVersion: libraryExpanded.lastScanVersion || null,
|
||||
lastScanMetadataPrecedence: libraryExpanded.extraData?.lastScanMetadataPrecedence || null,
|
||||
createdAt: libraryExpanded.createdAt.valueOf(),
|
||||
lastUpdate: libraryExpanded.updatedAt.valueOf()
|
||||
})
|
||||
|
|
@ -151,6 +155,9 @@ class Library extends Model {
|
|||
if (oldLibrary.oldLibraryId) {
|
||||
extraData.oldLibraryId = oldLibrary.oldLibraryId
|
||||
}
|
||||
if (oldLibrary.lastScanMetadataPrecedence) {
|
||||
extraData.lastScanMetadataPrecedence = oldLibrary.lastScanMetadataPrecedence
|
||||
}
|
||||
return {
|
||||
id: oldLibrary.id,
|
||||
name: oldLibrary.name,
|
||||
|
|
@ -159,6 +166,8 @@ class Library extends Model {
|
|||
mediaType: oldLibrary.mediaType || null,
|
||||
provider: oldLibrary.provider,
|
||||
settings: oldLibrary.settings?.toJSON() || {},
|
||||
lastScan: oldLibrary.lastScan || null,
|
||||
lastScanVersion: oldLibrary.lastScanVersion || null,
|
||||
createdAt: oldLibrary.createdAt,
|
||||
updatedAt: oldLibrary.lastUpdate,
|
||||
extraData
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ class LibraryItem extends Model {
|
|||
*
|
||||
* @param {number} offset
|
||||
* @param {number} limit
|
||||
* @returns {Promise<Model<LibraryItem>[]>} LibraryItem
|
||||
* @returns {Promise<LibraryItem[]>} LibraryItem
|
||||
*/
|
||||
static getLibraryItemsIncrement(offset, limit, where = null) {
|
||||
return this.findAll({
|
||||
|
|
|
|||
|
|
@ -112,6 +112,25 @@ class Podcast extends Model {
|
|||
}
|
||||
}
|
||||
|
||||
getAbsMetadataJson() {
|
||||
return {
|
||||
tags: this.tags || [],
|
||||
title: this.title,
|
||||
author: this.author,
|
||||
description: this.description,
|
||||
releaseDate: this.releaseDate,
|
||||
genres: this.genres || [],
|
||||
feedURL: this.feedURL,
|
||||
imageURL: this.imageURL,
|
||||
itunesPageURL: this.itunesPageURL,
|
||||
itunesId: this.itunesId,
|
||||
itunesArtistId: this.itunesArtistId,
|
||||
language: this.language,
|
||||
explicit: !!this.explicit,
|
||||
podcastType: this.podcastType
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize model
|
||||
* @param {import('../Database').sequelize} sequelize
|
||||
|
|
|
|||
|
|
@ -79,6 +79,7 @@ class PodcastEpisode extends Model {
|
|||
subtitle: this.subtitle,
|
||||
description: this.description,
|
||||
enclosure,
|
||||
guid: this.extraData?.guid || null,
|
||||
pubDate: this.pubDate,
|
||||
chapters: this.chapters,
|
||||
audioFile: this.audioFile,
|
||||
|
|
@ -98,6 +99,9 @@ class PodcastEpisode extends Model {
|
|||
if (oldEpisode.oldEpisodeId) {
|
||||
extraData.oldEpisodeId = oldEpisode.oldEpisodeId
|
||||
}
|
||||
if (oldEpisode.guid) {
|
||||
extraData.guid = oldEpisode.guid
|
||||
}
|
||||
return {
|
||||
id: oldEpisode.id,
|
||||
index: oldEpisode.index,
|
||||
|
|
|
|||
|
|
@ -59,6 +59,7 @@ class User extends Model {
|
|||
id: userExpanded.id,
|
||||
oldUserId: userExpanded.extraData?.oldUserId || null,
|
||||
username: userExpanded.username,
|
||||
email: userExpanded.email || null,
|
||||
pash: userExpanded.pash,
|
||||
type: userExpanded.type,
|
||||
token: userExpanded.token,
|
||||
|
|
@ -96,6 +97,7 @@ class User extends Model {
|
|||
return {
|
||||
id: oldUser.id,
|
||||
username: oldUser.username,
|
||||
email: oldUser.email || null,
|
||||
pash: oldUser.pash || null,
|
||||
type: oldUser.type || null,
|
||||
token: oldUser.token || null,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue