mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-02-03 16:59:41 +00:00
Init sqlite take 2
This commit is contained in:
parent
d86a3b3dc2
commit
cf7fd315b6
88 changed files with 7017 additions and 692 deletions
|
|
@ -12,6 +12,7 @@ const EBookFile = require('../files/EBookFile')
|
|||
|
||||
class Book {
|
||||
constructor(book) {
|
||||
this.id = null
|
||||
this.libraryItemId = null
|
||||
this.metadata = null
|
||||
|
||||
|
|
@ -32,6 +33,7 @@ class Book {
|
|||
}
|
||||
|
||||
construct(book) {
|
||||
this.id = book.id
|
||||
this.libraryItemId = book.libraryItemId
|
||||
this.metadata = new BookMetadata(book.metadata)
|
||||
this.coverPath = book.coverPath
|
||||
|
|
@ -46,6 +48,7 @@ class Book {
|
|||
|
||||
toJSON() {
|
||||
return {
|
||||
id: this.id,
|
||||
libraryItemId: this.libraryItemId,
|
||||
metadata: this.metadata.toJSON(),
|
||||
coverPath: this.coverPath,
|
||||
|
|
@ -59,6 +62,7 @@ class Book {
|
|||
|
||||
toJSONMinified() {
|
||||
return {
|
||||
id: this.id,
|
||||
metadata: this.metadata.toJSONMinified(),
|
||||
coverPath: this.coverPath,
|
||||
tags: [...this.tags],
|
||||
|
|
@ -75,6 +79,7 @@ class Book {
|
|||
|
||||
toJSONExpanded() {
|
||||
return {
|
||||
id: this.id,
|
||||
libraryItemId: this.libraryItemId,
|
||||
metadata: this.metadata.toJSONExpanded(),
|
||||
coverPath: this.coverPath,
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ const naturalSort = createNewSortInstance({
|
|||
|
||||
class Podcast {
|
||||
constructor(podcast) {
|
||||
this.id = null
|
||||
this.libraryItemId = null
|
||||
this.metadata = null
|
||||
this.coverPath = null
|
||||
|
|
@ -32,6 +33,7 @@ class Podcast {
|
|||
}
|
||||
|
||||
construct(podcast) {
|
||||
this.id = podcast.id
|
||||
this.libraryItemId = podcast.libraryItemId
|
||||
this.metadata = new PodcastMetadata(podcast.metadata)
|
||||
this.coverPath = podcast.coverPath
|
||||
|
|
@ -50,6 +52,7 @@ class Podcast {
|
|||
|
||||
toJSON() {
|
||||
return {
|
||||
id: this.id,
|
||||
libraryItemId: this.libraryItemId,
|
||||
metadata: this.metadata.toJSON(),
|
||||
coverPath: this.coverPath,
|
||||
|
|
@ -65,6 +68,7 @@ class Podcast {
|
|||
|
||||
toJSONMinified() {
|
||||
return {
|
||||
id: this.id,
|
||||
metadata: this.metadata.toJSONMinified(),
|
||||
coverPath: this.coverPath,
|
||||
tags: [...this.tags],
|
||||
|
|
@ -80,6 +84,7 @@ class Podcast {
|
|||
|
||||
toJSONExpanded() {
|
||||
return {
|
||||
id: this.id,
|
||||
libraryItemId: this.libraryItemId,
|
||||
metadata: this.metadata.toJSONExpanded(),
|
||||
coverPath: this.coverPath,
|
||||
|
|
@ -284,8 +289,9 @@ class Podcast {
|
|||
}
|
||||
|
||||
addNewEpisodeFromAudioFile(audioFile, index) {
|
||||
var pe = new PodcastEpisode()
|
||||
const pe = new PodcastEpisode()
|
||||
pe.libraryItemId = this.libraryItemId
|
||||
pe.podcastId = this.id
|
||||
audioFile.index = 1 // Only 1 audio file per episode
|
||||
pe.setDataFromAudioFile(audioFile, index)
|
||||
this.episodes.push(pe)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue