This commit is contained in:
Quentin 2026-02-22 17:38:35 -06:00 committed by GitHub
commit 09374268bb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 18 additions and 5 deletions

View file

@ -61,6 +61,8 @@ const libraryItemsBookFilters = require('../utils/queries/libraryItemsBookFilter
* @property {string} timeBase
* @property {number} channels
* @property {string} channelLayout
* @property {number} sampleRate
* @property {string} profile
* @property {ChapterObject[]} chapters
* @property {Object} metaTags
* @property {string} mimeType

View file

@ -24,6 +24,8 @@ class AudioFile {
this.timeBase = null
this.channels = null
this.channelLayout = null
this.sampleRate = null
this.profile = null
this.chapters = []
this.embeddedCoverArt = null
@ -62,6 +64,8 @@ class AudioFile {
timeBase: this.timeBase,
channels: this.channels,
channelLayout: this.channelLayout,
sampleRate: this.sampleRate,
profile: this.profile,
chapters: this.chapters,
embeddedCoverArt: this.embeddedCoverArt,
metaTags: this.metaTags?.toJSON() || {},
@ -94,6 +98,8 @@ class AudioFile {
this.timeBase = data.timeBase
this.channels = data.channels
this.channelLayout = data.channelLayout
this.sampleRate = data.sampleRate
this.profile = data.profile
this.chapters = data.chapters
this.embeddedCoverArt = data.embeddedCoverArt || null
@ -130,6 +136,8 @@ class AudioFile {
this.timeBase = probeData.timeBase
this.channels = probeData.channels
this.channelLayout = probeData.channelLayout
this.sampleRate = probeData.sampleRate
this.profile = probeData.profile
this.chapters = probeData.chapters || []
this.metaTags = probeData.audioMetaTags
this.embeddedCoverArt = probeData.embeddedCoverArt
@ -137,7 +145,7 @@ class AudioFile {
syncChapters(updatedChapters) {
if (this.chapters.length !== updatedChapters.length) {
this.chapters = updatedChapters.map(ch => ({ ...ch }))
this.chapters = updatedChapters.map((ch) => ({ ...ch }))
return true
} else if (updatedChapters.length === 0) {
if (this.chapters.length > 0) {
@ -154,7 +162,7 @@ class AudioFile {
}
}
if (hasUpdates) {
this.chapters = updatedChapters.map(ch => ({ ...ch }))
this.chapters = updatedChapters.map((ch) => ({ ...ch }))
}
return hasUpdates
}
@ -164,8 +172,8 @@ class AudioFile {
}
/**
*
* @param {AudioFile} scannedAudioFile
*
* @param {AudioFile} scannedAudioFile
* @returns {boolean} true if updates were made
*/
updateFromScan(scannedAudioFile) {
@ -196,4 +204,4 @@ class AudioFile {
return hasUpdated
}
}
module.exports = AudioFile
module.exports = AudioFile

View file

@ -17,6 +17,7 @@ class MediaProbeData {
this.channelLayout = null
this.channels = null
this.sampleRate = null
this.profile = null
this.chapters = []
this.audioMetaTags = null
@ -58,6 +59,7 @@ class MediaProbeData {
this.channelLayout = this.audioStream.channel_layout
this.channels = this.audioStream.channels
this.sampleRate = this.audioStream.sample_rate
this.profile = this.audioStream.profile
this.chapters = data.chapters || []
this.audioMetaTags = new AudioMetaTags()

View file

@ -114,6 +114,7 @@ function parseMediaStreamInfo(stream, all_streams, total_bit_rate) {
info.channels = stream.channels || null
info.sample_rate = tryGrabSampleRate(stream)
info.channel_layout = tryGrabChannelLayout(stream)
info.profile = stream.profile || null
}
return info