Init sqlite take 2

This commit is contained in:
advplyr 2023-07-04 18:14:44 -05:00
parent d86a3b3dc2
commit cf7fd315b6
88 changed files with 7017 additions and 692 deletions

View file

@ -1,12 +1,14 @@
const uuidv4 = require("uuid").v4
const Path = require('path')
const Logger = require('../../Logger')
const { getId, cleanStringForSearch, areEquivalent, copyValue } = require('../../utils/index')
const { cleanStringForSearch, areEquivalent, copyValue } = require('../../utils/index')
const AudioFile = require('../files/AudioFile')
const AudioTrack = require('../files/AudioTrack')
class PodcastEpisode {
constructor(episode) {
this.libraryItemId = null
this.podcastId = null
this.id = null
this.index = null
@ -32,6 +34,7 @@ class PodcastEpisode {
construct(episode) {
this.libraryItemId = episode.libraryItemId
this.podcastId = episode.podcastId
this.id = episode.id
this.index = episode.index
this.season = episode.season
@ -54,6 +57,7 @@ class PodcastEpisode {
toJSON() {
return {
libraryItemId: this.libraryItemId,
podcastId: this.podcastId,
id: this.id,
index: this.index,
season: this.season,
@ -75,6 +79,7 @@ class PodcastEpisode {
toJSONExpanded() {
return {
libraryItemId: this.libraryItemId,
podcastId: this.podcastId,
id: this.id,
index: this.index,
season: this.season,
@ -117,7 +122,7 @@ class PodcastEpisode {
}
setData(data, index = 1) {
this.id = getId('ep')
this.id = uuidv4()
this.index = index
this.title = data.title
this.subtitle = data.subtitle || ''
@ -133,7 +138,7 @@ class PodcastEpisode {
}
setDataFromAudioFile(audioFile, index) {
this.id = getId('ep')
this.id = uuidv4()
this.audioFile = audioFile
this.title = Path.basename(audioFile.metadata.filename, Path.extname(audioFile.metadata.filename))
this.index = index