mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-02-03 08:49:40 +00:00
Add: Filter and side rail button to show books with issues #132, Add: realtime updates for audiobook progress
This commit is contained in:
parent
874c910e24
commit
335bbac81d
14 changed files with 96 additions and 30 deletions
|
|
@ -193,16 +193,14 @@ class Audiobook {
|
|||
lastUpdate: this.lastUpdate,
|
||||
duration: this.totalDuration,
|
||||
size: this.totalSize,
|
||||
hasBookMatch: !!this.book,
|
||||
hasMissingParts: this.missingParts ? this.missingParts.length : 0,
|
||||
hasInvalidParts: this.invalidParts ? this.invalidParts.length : 0,
|
||||
// numEbooks: this.ebooks.length,
|
||||
ebooks: this.ebooks.map(ebook => ebook.toJSON()),
|
||||
numEbooks: this.ebooks.length,
|
||||
numTracks: this.tracks.length,
|
||||
chapters: this.chapters || [],
|
||||
isMissing: !!this.isMissing,
|
||||
isInvalid: !!this.isInvalid
|
||||
isInvalid: !!this.isInvalid,
|
||||
hasMissingParts: this.missingParts ? this.missingParts.length : 0,
|
||||
hasInvalidParts: this.invalidParts ? this.invalidParts.length : 0
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -232,7 +230,9 @@ class Audiobook {
|
|||
tracks: this.tracksToJSON(),
|
||||
chapters: this.chapters || [],
|
||||
isMissing: !!this.isMissing,
|
||||
isInvalid: !!this.isInvalid
|
||||
isInvalid: !!this.isInvalid,
|
||||
hasMissingParts: this.missingParts ? this.missingParts.length : 0,
|
||||
hasInvalidParts: this.invalidParts ? this.invalidParts.length : 0
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ class Stream extends EventEmitter {
|
|||
|
||||
get clientProgress() {
|
||||
if (!this.clientCurrentTime) return 0
|
||||
var prog = Math.max(1, this.clientCurrentTime / this.totalDuration)
|
||||
var prog = Math.min(1, this.clientCurrentTime / this.totalDuration)
|
||||
return Number(prog.toFixed(3))
|
||||
}
|
||||
|
||||
|
|
@ -248,6 +248,7 @@ class Stream extends EventEmitter {
|
|||
this.ffmpeg.inputOption('-seek_timestamp 1')
|
||||
this.ffmpeg.inputFormat('concat')
|
||||
this.ffmpeg.inputOption('-safe 0')
|
||||
// this.ffmpeg.inputOption('-segment_time_metadata 1')
|
||||
|
||||
if (this.startTime > 0) {
|
||||
const shiftedStartTime = this.startTime - trackStartTime
|
||||
|
|
@ -259,7 +260,7 @@ class Stream extends EventEmitter {
|
|||
this.ffmpeg.inputOption('-noaccurate_seek')
|
||||
}
|
||||
|
||||
const logLevel = process.env.NODE_ENV === 'production' ? 'error' : 'warning'
|
||||
const logLevel = process.env.NODE_ENV === 'production' ? 'error' : 'error'
|
||||
const audioCodec = (this.hlsSegmentType === 'fmp4' || this.tracksAudioFileType === 'opus') ? 'aac' : 'copy'
|
||||
this.ffmpeg.addOption([
|
||||
`-loglevel ${logLevel}`,
|
||||
|
|
@ -270,7 +271,6 @@ class Stream extends EventEmitter {
|
|||
'-f hls',
|
||||
"-copyts",
|
||||
"-avoid_negative_ts make_non_negative",
|
||||
// '-start_at_zero',
|
||||
"-max_delay 5000000",
|
||||
"-max_muxing_queue_size 2048",
|
||||
`-hls_time 6`,
|
||||
|
|
|
|||
|
|
@ -203,6 +203,7 @@ class User {
|
|||
this.audiobooks[stream.audiobookId] = new AudiobookProgress()
|
||||
}
|
||||
this.audiobooks[stream.audiobookId].updateFromStream(stream)
|
||||
return this.audiobooks[stream.audiobookId]
|
||||
}
|
||||
|
||||
updateAudiobookProgress(audiobook, updatePayload) {
|
||||
|
|
@ -267,5 +268,9 @@ class User {
|
|||
if (!this.librariesAccessible) return false
|
||||
return this.librariesAccessible.includes(libraryId)
|
||||
}
|
||||
|
||||
getAudiobookJSON(audiobookId) {
|
||||
return this.audiobooks[audiobookId] ? this.audiobooks[audiobookId].toJSON() : null
|
||||
}
|
||||
}
|
||||
module.exports = User
|
||||
Loading…
Add table
Add a link
Reference in a new issue