0.12.0-5 Pre-Plugin
This commit is contained in:
@@ -17,14 +17,14 @@ const { ensureDir } = require('../utils/files');
|
||||
*
|
||||
* Deshalb:
|
||||
* rip() → No-Op (Datei liegt bereits im rawDir)
|
||||
* encode() → ffmpeg-Encoding (Single-File oder per Chapter)
|
||||
* review() → null (kein HandBrake-Preview)
|
||||
* encode() → ffmpeg Single-File oder kapitelweise
|
||||
*
|
||||
* detect() prüft das mediaProfile-Feld (gesetzt vom Orchestrator für
|
||||
* Datei-Uploads) oder eine Dateiendung im discInfo.
|
||||
*
|
||||
* Pflicht-Felder in ctx.extra für analyze():
|
||||
* filePath - Absoluter Pfad zur .aax-Datei
|
||||
* filePath - Absoluter Pfad zur .aax-Datei
|
||||
*
|
||||
* Pflicht-Felder in ctx.extra für encode():
|
||||
* inputPath - Absoluter Pfad zur .aax-Input-Datei
|
||||
@@ -132,8 +132,7 @@ class AudiobookPlugin extends SourcePlugin {
|
||||
}
|
||||
|
||||
/**
|
||||
* Encodiert die .aax-Datei mit ffmpeg.
|
||||
* Unterstützt Single-File (M4B) und kapitelweise Ausgabe (MP3, FLAC).
|
||||
* Encodiert die .aax-Datei mit ffmpeg — als Einzel-Datei oder kapitelweise.
|
||||
*
|
||||
* @param {object} job
|
||||
* @param {PluginContext} ctx
|
||||
@@ -146,6 +145,12 @@ class AudiobookPlugin extends SourcePlugin {
|
||||
pluginFile: 'AudiobookPlugin.js'
|
||||
});
|
||||
|
||||
const settings = await ctx.settings.getSettingsMap();
|
||||
if (!settings.audiobook_encoding_enabled) {
|
||||
ctx.logger.info('audiobook:encode:disabled', { jobId: job?.id });
|
||||
return;
|
||||
}
|
||||
|
||||
const {
|
||||
inputPath,
|
||||
outputPath,
|
||||
@@ -171,7 +176,6 @@ class AudiobookPlugin extends SourcePlugin {
|
||||
throw error;
|
||||
}
|
||||
|
||||
const settings = await ctx.settings.getSettingsMap();
|
||||
const ffmpegCommand = String(settings.ffmpeg_command || 'ffmpeg').trim() || 'ffmpeg';
|
||||
const normalizedFormat = audiobookService.normalizeOutputFormat(outputFormat);
|
||||
const normalizedOptions = audiobookService.normalizeFormatOptions(normalizedFormat, formatOptions);
|
||||
@@ -203,7 +207,6 @@ class AudiobookPlugin extends SourcePlugin {
|
||||
outputPath
|
||||
});
|
||||
|
||||
// Ergebnis für den Orchestrator ablegen
|
||||
ctx.extra.encodeResult = {
|
||||
outputPath,
|
||||
format: normalizedFormat,
|
||||
@@ -233,6 +236,18 @@ class AudiobookPlugin extends SourcePlugin {
|
||||
*/
|
||||
getSettingsSchema() {
|
||||
return [
|
||||
{
|
||||
key: 'audiobook_encoding_enabled',
|
||||
category: 'Features',
|
||||
label: 'Audiobook Encoding',
|
||||
type: 'boolean',
|
||||
required: 1,
|
||||
description: 'Audiobook-Encoding über das Plugin aktivieren.',
|
||||
default_value: 'true',
|
||||
options_json: '[]',
|
||||
validation_json: '{}',
|
||||
order_index: 100
|
||||
},
|
||||
{
|
||||
key: 'ffmpeg_command',
|
||||
category: 'Tools',
|
||||
@@ -283,10 +298,7 @@ class AudiobookPlugin extends SourcePlugin {
|
||||
outputPath,
|
||||
normalizedFormat,
|
||||
normalizedOptions,
|
||||
{
|
||||
activationBytes,
|
||||
metadata
|
||||
}
|
||||
{ activationBytes, metadata }
|
||||
);
|
||||
|
||||
ctx.logger.info('audiobook:encode:single-file', {
|
||||
|
||||
@@ -153,16 +153,27 @@ class VideoDiscPlugin extends SourcePlugin {
|
||||
const reviewSilent = Boolean(ctx.extra?.reviewSilent);
|
||||
let runInfo;
|
||||
if (runCommandFn) {
|
||||
runInfo = await runCommandFn({
|
||||
jobId: job?.id,
|
||||
stage: reviewStage,
|
||||
source: reviewSource,
|
||||
cmd: scanConfig.cmd,
|
||||
args: scanConfig.args,
|
||||
collectLines: scanLines,
|
||||
collectStderrLines: false,
|
||||
silent: reviewSilent
|
||||
});
|
||||
try {
|
||||
runInfo = await runCommandFn({
|
||||
jobId: job?.id,
|
||||
stage: reviewStage,
|
||||
source: reviewSource,
|
||||
cmd: scanConfig.cmd,
|
||||
args: scanConfig.args,
|
||||
collectLines: scanLines,
|
||||
collectStderrLines: false,
|
||||
silent: reviewSilent
|
||||
});
|
||||
} catch (cmdError) {
|
||||
// runCommand collected stdout lines via callbacks before throwing.
|
||||
// Recover the runInfo from the error so the caller can still parse
|
||||
// whatever output HandBrakeCLI produced (e.g. exit code 2 with valid JSON).
|
||||
runInfo = cmdError?.runInfo || {
|
||||
status: 'ERROR',
|
||||
exitCode: typeof cmdError?.code === 'number' ? cmdError.code : 1,
|
||||
errorMessage: cmdError?.message || String(cmdError)
|
||||
};
|
||||
}
|
||||
} else {
|
||||
runInfo = await _runCommandCaptured({
|
||||
cmd: scanConfig.cmd,
|
||||
|
||||
Reference in New Issue
Block a user