0.12.0-15 Fix DVD Review

This commit is contained in:
2026-03-24 07:05:45 +00:00
parent 3e3f3231be
commit 76b020d5c0
30 changed files with 5148 additions and 44 deletions
+51 -4
View File
@@ -326,6 +326,13 @@ function inferMediaType(job, makemkvInfo, mediainfoInfo, encodePlan, handbrakeIn
return profileHint;
}
// Converter jobs: detected via media_type field (plan.mediaProfile = 'converter')
const rawMediaType = normalizeMediaTypeValue(job?.media_type);
const rawPlanProfile = String(plan?.mediaProfile || '').trim().toLowerCase();
if (rawPlanProfile === 'converter' || rawMediaType === 'converter') {
return 'converter';
}
const statusCandidates = [
job?.status,
job?.last_state,
@@ -530,6 +537,29 @@ function resolveEffectiveStoragePathsForJob(settings = null, job = {}, parsed =
const handbrakeInfo = parsed?.handbrakeInfo || parseJsonSafe(job?.handbrake_info_json, null);
const mediaType = inferMediaType(job, mkInfo, miInfo, plan, handbrakeInfo);
const directoryLikeOutput = isDirectoryLikeOutput(mediaType, plan, handbrakeInfo);
// Converter jobs use their own storage dirs — do not remap output path
if (mediaType === 'converter') {
const s = settings || {};
const converterMediaType = String(plan?.converterMediaType || '').trim().toLowerCase();
const converterMovieDir = converterMediaType === 'audio'
? (String(s.converter_audio_dir || '').trim() || String(s.converter_movie_dir || '').trim())
: String(s.converter_movie_dir || '').trim();
const converterRawDir = String(s.converter_raw_dir || '').trim();
return {
mediaType: 'converter',
directoryLikeOutput: false,
rawDir: converterRawDir,
movieDir: converterMovieDir,
effectiveRawPath: job?.raw_path || null,
effectiveOutputPath: job?.output_path || null,
makemkvInfo: mkInfo,
mediainfoInfo: miInfo,
handbrakeInfo,
encodePlan: plan
};
}
const effectiveSettings = settingsService.resolveEffectiveToolSettings(settings || {}, mediaType);
const rawDir = String(effectiveSettings?.raw_dir || '').trim();
const configuredMovieDir = String(effectiveSettings?.movie_dir || '').trim();
@@ -4325,8 +4355,20 @@ class HistoryService {
} else {
const rawPath = normalizeComparablePath(effectiveRawPath);
const rawRoot = normalizeComparablePath(effectiveRawDir);
const keepRoot = rawPath === rawRoot;
const result = deleteFilesRecursively(effectiveRawPath, keepRoot);
const stat = fs.lstatSync(rawPath);
const isFile = stat.isFile();
// Für Converter-Jobs: Datei liegt in einem Unterordner → Ordner löschen
let deletePath = rawPath;
if (isFile && resolvedPaths.mediaType === 'converter') {
const parentDir = normalizeComparablePath(path.dirname(rawPath));
if (parentDir && parentDir !== rawRoot && isPathInside(rawRoot, parentDir)) {
deletePath = parentDir;
}
}
const keepRoot = deletePath === rawRoot;
const result = deleteFilesRecursively(deletePath, keepRoot);
summary.raw.deleted = true;
summary.raw.filesDeleted = result.filesDeleted;
summary.raw.dirsRemoved = result.dirsRemoved;
@@ -4371,7 +4413,9 @@ class HistoryService {
summary.movie.reason = null;
} else {
const parentDir = normalizeComparablePath(path.dirname(trackedPath));
const canDeleteParentDir = parentDir
const isConverterJob = resolvedPaths.mediaType === 'converter';
const canDeleteParentDir = !isConverterJob
&& parentDir
&& parentDir !== movieRoot
&& isPathInside(movieRoot, parentDir)
&& fs.existsSync(parentDir)
@@ -4413,7 +4457,10 @@ class HistoryService {
movieCandidatePathForTracking = outputPath;
} else {
const parentDir = normalizeComparablePath(path.dirname(outputPath));
const canDeleteParentDir = parentDir
// Converter jobs output a single file — never delete the parent dir
const isConverterJob = resolvedPaths.mediaType === 'converter';
const canDeleteParentDir = !isConverterJob
&& parentDir
&& parentDir !== movieRoot
&& isPathInside(movieRoot, parentDir)
&& fs.existsSync(parentDir)