mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-01-03 00:06:46 +01:00
Remove node-ffprobe dependency
This commit is contained in:
parent
d0af1c3c9a
commit
8562b8d1b3
5
package-lock.json
generated
5
package-lock.json
generated
@ -846,11 +846,6 @@
|
|||||||
"resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz",
|
"resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz",
|
||||||
"integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg=="
|
"integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg=="
|
||||||
},
|
},
|
||||||
"node-ffprobe": {
|
|
||||||
"version": "3.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/node-ffprobe/-/node-ffprobe-3.0.0.tgz",
|
|
||||||
"integrity": "sha512-2LNTLStz2hw/urwo4xJ00TIOvthgepcl3tF4HB8BWnhJ4nhJ7S08YThapBHkGLYV+GUuY9pML/kX76+dqY2iUg=="
|
|
||||||
},
|
|
||||||
"normalize-path": {
|
"normalize-path": {
|
||||||
"version": "3.0.0",
|
"version": "3.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz",
|
||||||
|
@ -41,7 +41,6 @@
|
|||||||
"fluent-ffmpeg": "^2.1.2",
|
"fluent-ffmpeg": "^2.1.2",
|
||||||
"htmlparser2": "^8.0.1",
|
"htmlparser2": "^8.0.1",
|
||||||
"jsonwebtoken": "^8.5.1",
|
"jsonwebtoken": "^8.5.1",
|
||||||
"node-ffprobe": "^3.0.0",
|
|
||||||
"socket.io": "^4.4.1",
|
"socket.io": "^4.4.1",
|
||||||
"xml2js": "^0.4.23"
|
"xml2js": "^0.4.23"
|
||||||
}
|
}
|
||||||
|
22
server/libs/nodeFfprobe/LICENSE
Normal file
22
server/libs/nodeFfprobe/LICENSE
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
(The MIT License)
|
||||||
|
|
||||||
|
Copyright (c) 2011 Listener Approved LLC.
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of this software and associated documentation files (the
|
||||||
|
'Software'), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be
|
||||||
|
included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||||
|
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
28
server/libs/nodeFfprobe/index.js
Normal file
28
server/libs/nodeFfprobe/index.js
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
//
|
||||||
|
// node-ffprobe modified for audiobookshelf
|
||||||
|
// SOURCE: https://github.com/ListenerApproved/node-ffprobe
|
||||||
|
//
|
||||||
|
|
||||||
|
const spawn = require('child_process').spawn
|
||||||
|
|
||||||
|
module.exports = (function () {
|
||||||
|
function doProbe(file) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
let proc = spawn(module.exports.FFPROBE_PATH || 'ffprobe', ['-hide_banner', '-loglevel', 'fatal', '-show_error', '-show_format', '-show_streams', '-show_programs', '-show_chapters', '-show_private_data', '-print_format', 'json', file])
|
||||||
|
let probeData = []
|
||||||
|
let errData = []
|
||||||
|
|
||||||
|
proc.stdout.setEncoding('utf8')
|
||||||
|
proc.stderr.setEncoding('utf8')
|
||||||
|
|
||||||
|
proc.stdout.on('data', function (data) { probeData.push(data) })
|
||||||
|
proc.stderr.on('data', function (data) { errData.push(data) })
|
||||||
|
|
||||||
|
proc.on('exit', code => { exitCode = code })
|
||||||
|
proc.on('error', err => reject(err))
|
||||||
|
proc.on('close', () => resolve(JSON.parse(probeData.join(''))))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
return doProbe
|
||||||
|
})()
|
@ -1,4 +1,4 @@
|
|||||||
const ffprobe = require('node-ffprobe')
|
const ffprobe = require('../libs/nodeFfprobe')
|
||||||
const MediaProbeData = require('../scanner/MediaProbeData')
|
const MediaProbeData = require('../scanner/MediaProbeData')
|
||||||
|
|
||||||
const Logger = require('../Logger')
|
const Logger = require('../Logger')
|
||||||
|
Loading…
Reference in New Issue
Block a user