Support for opus audio type, experimental features toggle, epub reader starting point

This commit is contained in:
advplyr 2021-10-02 13:50:39 -05:00
parent 3dd8dc6dd4
commit bd336345ee
14 changed files with 880 additions and 72 deletions

View file

@ -115,6 +115,10 @@ class Audiobook {
return this.otherFiles.filter(file => file.filetype === 'ebook')
}
get hasEpub() {
return this.otherFiles.find(file => file.ext === '.epub')
}
get hasMissingIno() {
return !this.ino || this._audioFiles.find(abf => !abf.ino) || this._otherFiles.find(f => !f.ino) || (this.tracks || []).find(t => !t.ino)
}
@ -173,7 +177,8 @@ class Audiobook {
hasBookMatch: !!this.book,
hasMissingParts: this.missingParts ? this.missingParts.length : 0,
hasInvalidParts: this.invalidParts ? this.invalidParts.length : 0,
numEbooks: this.ebooks.length,
// numEbooks: this.ebooks.length,
numEbooks: this.hasEpub ? 1 : 0,
numTracks: this.tracks.length,
chapters: this.chapters || [],
isMissing: !!this.isMissing

View file

@ -50,6 +50,11 @@ class Stream extends EventEmitter {
return this.audiobook.totalDuration
}
get tracksAudioFileType() {
if (!this.tracks.length) return null
return this.tracks[0].ext.toLowerCase().slice(1)
}
get hlsSegmentType() {
var hasFlac = this.tracks.find(t => t.ext.toLowerCase() === '.flac')
return hasFlac ? 'fmp4' : 'mpegts'
@ -247,7 +252,7 @@ class Stream extends EventEmitter {
}
const logLevel = process.env.NODE_ENV === 'production' ? 'error' : 'warning'
const audioCodec = this.hlsSegmentType === 'fmp4' ? 'aac' : 'copy'
const audioCodec = (this.hlsSegmentType === 'fmp4' || this.tracksAudioFileType === 'opus') ? 'aac' : 'copy'
this.ffmpeg.addOption([
`-loglevel ${logLevel}`,
'-map 0:a',