Improve rename and extractor diagnostics

This commit is contained in:
Sucukdeluxe
2026-03-08 22:37:07 +01:00
parent 9fd4dd452a
commit 5ef9575b95
4 changed files with 61 additions and 3 deletions
+26
View File
@@ -2682,6 +2682,13 @@ export class DownloadManager extends EventEmitter {
forceEpisodeForSeasonFolder: true
});
if (!targetBaseName) {
if (pkg) {
this.logPackageForPackage(pkg, "WARN", "Auto-Rename übersprungen: kein Zielname", {
sourceName,
sourceBaseName,
folders: folderCandidates.join(", ")
});
}
logger.info(`Auto-Rename: kein Zielname für ${sourceName} (folders=${folderCandidates.join(", ")})`);
continue;
}
@@ -2706,6 +2713,13 @@ export class DownloadManager extends EventEmitter {
}
}
if (!targetPath) {
if (pkg) {
this.logPackageForPackage(pkg, "WARN", "Auto-Rename übersprungen: Zielpfad ungültig", {
sourceName,
sourceBaseName,
targetBaseName
});
}
logger.warn(`Auto-Rename übersprungen (Zielpfad zu lang/ungültig): ${sourcePath}`);
continue;
}
@@ -2713,6 +2727,12 @@ export class DownloadManager extends EventEmitter {
continue;
}
if (await this.existsAsync(targetPath)) {
if (pkg) {
this.logPackageForPackage(pkg, "WARN", "Auto-Rename übersprungen: Ziel existiert", {
sourceName,
targetPath
});
}
logger.warn(`Auto-Rename übersprungen (Ziel existiert): ${targetPath}`);
continue;
}
@@ -2758,6 +2778,12 @@ export class DownloadManager extends EventEmitter {
}
}
logger.warn(`Auto-Rename fehlgeschlagen (${sourceName}): ${compactErrorText(error)}`);
if (pkg) {
this.logPackageForPackage(pkg, "WARN", "Auto-Rename fehlgeschlagen", {
sourceName,
error: compactErrorText(error)
});
}
}
}
+9 -3
View File
@@ -457,8 +457,14 @@ function effectiveConflictMode(conflictMode: ConflictMode): "overwrite" | "skip"
return "skip";
}
function cleanErrorText(text: string): string {
return String(text || "").replace(/\s+/g, " ").trim().slice(0, 500);
export function cleanErrorText(text: string): string {
const normalized = String(text || "").replace(/\s+/g, " ").trim();
if (normalized.length <= 500) {
return normalized;
}
const head = normalized.slice(0, 240).trimEnd();
const tail = normalized.slice(-240).trimStart();
return `${head} ... ${tail}`;
}
function appendLimited(base: string, chunk: string, maxLen = MAX_EXTRACT_OUTPUT_BUFFER): string {
@@ -2342,7 +2348,7 @@ async function runExternalExtractInner(
let bestPercent = 0;
let passwordAttempt = 0;
let usePerformanceFlags = externalExtractorSupportsPerfFlags && shouldUseExtractorPerformanceFlags();
const summarizeResultError = (errorText: string): string => cleanErrorText(errorText).slice(0, 280);
const summarizeResultError = (errorText: string): string => cleanErrorText(errorText);
let createErrorText = "";
let createErrorPassword = "";