mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-08-09 07:14:52 +02:00
Remove fluent-ffmpeg dependency
This commit is contained in:
41
server/libs/fluentFfmpeg/options/misc.js
Normal file
41
server/libs/fluentFfmpeg/options/misc.js
Normal file
@ -0,0 +1,41 @@
|
||||
/*jshint node:true*/
|
||||
'use strict';
|
||||
|
||||
var path = require('path');
|
||||
|
||||
/*
|
||||
*! Miscellaneous methods
|
||||
*/
|
||||
|
||||
module.exports = function(proto) {
|
||||
/**
|
||||
* Use preset
|
||||
*
|
||||
* @method FfmpegCommand#preset
|
||||
* @category Miscellaneous
|
||||
* @aliases usingPreset
|
||||
*
|
||||
* @param {String|Function} preset preset name or preset function
|
||||
*/
|
||||
proto.usingPreset =
|
||||
proto.preset = function(preset) {
|
||||
if (typeof preset === 'function') {
|
||||
preset(this);
|
||||
} else {
|
||||
try {
|
||||
var modulePath = path.join(this.options.presets, preset);
|
||||
var module = require(modulePath);
|
||||
|
||||
if (typeof module.load === 'function') {
|
||||
module.load(this);
|
||||
} else {
|
||||
throw new Error('preset ' + modulePath + ' has no load() function');
|
||||
}
|
||||
} catch (err) {
|
||||
throw new Error('preset ' + modulePath + ' could not be loaded: ' + err.message);
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
};
|
Reference in New Issue
Block a user