mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-01-08 00:08:14 +01:00
Fix ffmpeg concat file escaping
This commit is contained in:
parent
de8b0abc3a
commit
fe2ba083be
@ -8,8 +8,8 @@ const { filePathToPOSIX, copyToExisting } = require('./fileUtils')
|
|||||||
const LibraryItem = require('../objects/LibraryItem')
|
const LibraryItem = require('../objects/LibraryItem')
|
||||||
|
|
||||||
function escapeSingleQuotes(path) {
|
function escapeSingleQuotes(path) {
|
||||||
// return path.replace(/'/g, '\'\\\'\'')
|
// A ' within a quoted string is escaped with '\'' in ffmpeg (see https://www.ffmpeg.org/ffmpeg-utils.html#Quoting-and-escaping)
|
||||||
return filePathToPOSIX(path).replace(/ /g, '\\ ').replace(/'/g, "\\'")
|
return filePathToPOSIX(path).replace(/'/g, "'\\''")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns first track start time
|
// Returns first track start time
|
||||||
@ -33,7 +33,7 @@ async function writeConcatFile(tracks, outputPath, startTime = 0) {
|
|||||||
|
|
||||||
var tracksToInclude = tracks.filter((t) => t.index >= trackToStartWithIndex)
|
var tracksToInclude = tracks.filter((t) => t.index >= trackToStartWithIndex)
|
||||||
var trackPaths = tracksToInclude.map((t) => {
|
var trackPaths = tracksToInclude.map((t) => {
|
||||||
var line = 'file ' + escapeSingleQuotes(t.metadata.path) + '\n' + `duration ${t.duration}`
|
var line = "file '" + escapeSingleQuotes(t.metadata.path) + "'\n" + `duration ${t.duration}`
|
||||||
return line
|
return line
|
||||||
})
|
})
|
||||||
var inputstr = trackPaths.join('\n\n')
|
var inputstr = trackPaths.join('\n\n')
|
||||||
|
Loading…
Reference in New Issue
Block a user