Change:Fallback to audio stream tags if probe format has no tags and remove old scanner #256

This commit is contained in:
advplyr 2021-12-24 18:06:17 -06:00
parent 3f8551f9a1
commit a17348f916
12 changed files with 97 additions and 1269 deletions

View file

@ -21,20 +21,13 @@ class AudioProbeData {
this.trackTotal = null
}
getDefaultAudioStream(audioStreams) {
if (audioStreams.length === 1) return audioStreams[0]
var defaultStream = audioStreams.find(a => a.is_default)
if (!defaultStream) return audioStreams[0]
return defaultStream
}
getEmbeddedCoverArt(videoStream) {
const ImageCodecs = ['mjpeg', 'jpeg', 'png']
return ImageCodecs.includes(videoStream.codec) ? videoStream.codec : null
}
setData(data) {
var audioStream = this.getDefaultAudioStream(data.audio_streams)
var audioStream = data.audio_stream
this.embeddedCoverArt = data.video_stream ? this.getEmbeddedCoverArt(data.video_stream) : null
this.format = data.format
this.duration = data.duration