mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-07-24 12:54:31 +02:00
New data model play media entity, PlaybackSessionManager
This commit is contained in:
parent
1cf9e85272
commit
099ae7c776
54 changed files with 841 additions and 902 deletions
|
@ -64,7 +64,8 @@ class AudioFile {
|
|||
channelLayout: this.channelLayout,
|
||||
chapters: this.chapters,
|
||||
embeddedCoverArt: this.embeddedCoverArt,
|
||||
metaTags: this.metaTags ? this.metaTags.toJSON() : {}
|
||||
metaTags: this.metaTags ? this.metaTags.toJSON() : {},
|
||||
mimeType: this.mimeType
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -72,9 +73,6 @@ class AudioFile {
|
|||
this.index = data.index
|
||||
this.ino = data.ino
|
||||
this.metadata = new FileMetadata(data.metadata || {})
|
||||
if (!this.metadata.toJSON) {
|
||||
console.error('No metadata tojosnm\n\n\n\n\n\n', this)
|
||||
}
|
||||
this.addedAt = data.addedAt
|
||||
this.updatedAt = data.updatedAt
|
||||
this.manuallyVerified = !!data.manuallyVerified
|
||||
|
@ -103,6 +101,22 @@ class AudioFile {
|
|||
this.metaTags = new AudioMetaTags(data.metaTags || {})
|
||||
}
|
||||
|
||||
get mimeType() {
|
||||
var ext = this.metadata.ext
|
||||
if (ext === '.mp3' || ext === '.m4b' || ext === '.m4a') {
|
||||
return 'audio/mpeg'
|
||||
} else if (ext === '.mp4') {
|
||||
return 'audio/mp4'
|
||||
} else if (ext === '.ogg') {
|
||||
return 'audio/ogg'
|
||||
} else if (ext === '.aac' || ext === '.m4p') {
|
||||
return 'audio/aac'
|
||||
} else if (ext === '.flac') {
|
||||
return 'audio/flac'
|
||||
}
|
||||
return 'audio/mpeg'
|
||||
}
|
||||
|
||||
// New scanner creates AudioFile from AudioFileScanner
|
||||
setDataFromProbe(libraryFile, probeData) {
|
||||
this.ino = libraryFile.ino || null
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue