mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-01-16 02:48:41 +01:00
Update merge for m4b files, add progress event for local audiobooks
This commit is contained in:
parent
beaa1e14bb
commit
c30955f909
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "audiobookshelf-client",
|
||||
"version": "1.1.3",
|
||||
"version": "1.1.4",
|
||||
"description": "Audiobook manager and player",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "audiobookshelf",
|
||||
"version": "1.1.3",
|
||||
"version": "1.1.4",
|
||||
"description": "Self-hosted audiobook server for managing and playing audiobooks.",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
|
@ -117,6 +117,7 @@ class DownloadManager {
|
||||
|
||||
const logLevel = process.env.NODE_ENV === 'production' ? 'error' : 'warning'
|
||||
var ffmpegOptions = [`-loglevel ${logLevel}`]
|
||||
var ffmpegOutputOptions = []
|
||||
|
||||
if (requiresEncode) {
|
||||
ffmpegOptions = ffmpegOptions.concat([
|
||||
@ -128,6 +129,10 @@ class DownloadManager {
|
||||
])
|
||||
} else {
|
||||
ffmpegOptions.push('-c copy')
|
||||
if (download.ext === '.m4b') {
|
||||
Logger.info('Concat m4b\'s use -f mp4')
|
||||
ffmpegOutputOptions.push('-f mp4')
|
||||
}
|
||||
}
|
||||
|
||||
if (download.includeMetadata) {
|
||||
@ -153,6 +158,7 @@ class DownloadManager {
|
||||
var workerData = {
|
||||
inputs: ffmpegInputs,
|
||||
options: ffmpegOptions,
|
||||
outputOptions: ffmpegOutputOptions,
|
||||
output: download.fullPath,
|
||||
}
|
||||
|
||||
|
@ -205,6 +205,7 @@ class Server {
|
||||
socket.on('open_stream', (audiobookId) => this.streamManager.openStreamSocketRequest(socket, audiobookId))
|
||||
socket.on('close_stream', () => this.streamManager.closeStreamRequest(socket))
|
||||
socket.on('stream_update', (payload) => this.streamManager.streamUpdate(socket, payload))
|
||||
socket.on('progress_update', (payload) => this.audiobookProgressUpdate(socket.sheepClient, payload))
|
||||
socket.on('download', (payload) => this.downloadManager.downloadSocketRequest(socket, payload))
|
||||
socket.on('test', () => {
|
||||
socket.emit('test_received', socket.id)
|
||||
@ -230,6 +231,14 @@ class Server {
|
||||
res.sendStatus(200)
|
||||
}
|
||||
|
||||
audiobookProgressUpdate(client, progressPayload) {
|
||||
if (!client || !client.user) {
|
||||
Logger.error('[Server] audiobookProgressUpdate invalid socket client')
|
||||
return
|
||||
}
|
||||
client.user.updateAudiobookProgressFromStream(progressPayload)
|
||||
}
|
||||
|
||||
async authenticateSocket(socket, token) {
|
||||
var user = await this.auth.verifyToken(token)
|
||||
if (!user) {
|
||||
|
@ -19,6 +19,7 @@ workerData.inputs.forEach((inputData) => {
|
||||
})
|
||||
|
||||
if (workerData.options) ffmpegCommand.addOption(workerData.options)
|
||||
if (workerData.outputOptions && workerData.outputOptions.length) ffmpegCommand.addOutputOption(workerData.outputOptions)
|
||||
ffmpegCommand.output(workerData.output)
|
||||
|
||||
var isKilled = false
|
||||
|
Loading…
Reference in New Issue
Block a user