mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-08-25 21:46:01 +02:00
.devcontainer
.github
.vscode
build
client
docs
images
server
controllers
finders
libs
managers
models
objects
entities
files
AudioFile.js
AudioTrack.js
EBookFile.js
LibraryFile.js
VideoFile.js
VideoTrack.js
mediaTypes
metadata
settings
user
Backup.js
Collection.js
DailyLog.js
DeviceInfo.js
Feed.js
FeedEpisode.js
FeedMeta.js
Folder.js
Library.js
LibraryItem.js
Notification.js
PlaybackSession.js
Playlist.js
PodcastEpisodeDownload.js
Stream.js
Task.js
providers
routers
scanner
utils
Auth.js
Database.js
Logger.js
Server.js
SocketAuthority.js
Watcher.js
test
.dockerignore
.editorconfig
.gitattributes
.gitignore
.prettierrc
Dockerfile
LICENSE
custom-metadata-provider-specification.yaml
docker-compose.yml
docker-template.xml
index.js
package-lock.json
package.json
prod.js
readme.md
47 lines
1.2 KiB
JavaScript
47 lines
1.2 KiB
JavaScript
class AudioTrack {
|
|
constructor() {
|
|
this.index = null
|
|
this.startOffset = null
|
|
this.duration = null
|
|
this.title = null
|
|
this.contentUrl = null
|
|
this.mimeType = null
|
|
this.codec = null
|
|
this.metadata = null
|
|
}
|
|
|
|
toJSON() {
|
|
return {
|
|
index: this.index,
|
|
startOffset: this.startOffset,
|
|
duration: this.duration,
|
|
title: this.title,
|
|
contentUrl: this.contentUrl,
|
|
mimeType: this.mimeType,
|
|
codec: this.codec,
|
|
metadata: this.metadata?.toJSON() || null
|
|
}
|
|
}
|
|
|
|
setData(itemId, audioFile, startOffset) {
|
|
this.index = audioFile.index
|
|
this.startOffset = startOffset
|
|
this.duration = audioFile.duration
|
|
this.title = audioFile.metadata.filename || ''
|
|
|
|
this.contentUrl = `${global.RouterBasePath}/api/items/${itemId}/file/${audioFile.ino}`
|
|
this.mimeType = audioFile.mimeType
|
|
this.codec = audioFile.codec || null
|
|
this.metadata = audioFile.metadata.clone()
|
|
}
|
|
|
|
setFromStream(title, duration, contentUrl) {
|
|
this.index = 1
|
|
this.startOffset = 0
|
|
this.duration = duration
|
|
this.title = title
|
|
this.contentUrl = contentUrl
|
|
this.mimeType = 'application/vnd.apple.mpegurl'
|
|
}
|
|
}
|
|
module.exports = AudioTrack |