feat(analyzer): enhance anime detection with accent normalization and flexible matching
Build / Lint & Test (push) Successful in 19s
Build / Lint & Test (push) Successful in 19s
This commit is contained in:
1 parent
c46e3dfdb3
commit
2ea83ae566
5 files changed
+143
-12
No files matched your search
@@ -87,6 +87,40 @@ const AUDIO_INPUTS = {
|
||||
eq(o.variables.isMovie, 'true', 'Windows backslash path: /Radarr still matched');
|
||||
cleanup(a); }
|
||||
|
||||
// Family Guy (space in anime list, dots in folder & file name)
|
||||
{ const a = makeArgs('/media/toshiba/Sonarr/Family.Guy.1999 [tvdbid-75978]/Family.Guy.S00/Family.Guy.S00E64.mkv',
|
||||
[makeStream({ r_frame_rate:'24000/1001', height:1080 })],
|
||||
Object.assign({}, ANALYZER_INPUTS, { animeSeries: 'Simpson|Griffin|Family Guy|South Park' }));
|
||||
const o = await analyzerPlugin(a);
|
||||
eq(o.variables.isAnimation, 'true', 'Family Guy (dots vs spaces in name): isAnimation=true');
|
||||
eq(o.variables.x265Tune, 'animation', 'Family Guy: x265Tune=animation');
|
||||
eq(o.variables.vBitrate, '2000k', 'Family Guy 1080p: anime HD bitrate=2000k');
|
||||
cleanup(a); }
|
||||
|
||||
// Anime detected via variables.originalLibraryFile when workDir copy is input
|
||||
{ const a = makeArgs('C:\\workDir\\Family.Guy.S00E64_old.mkv',
|
||||
[makeStream({ r_frame_rate:'24000/1001', height:1080 })],
|
||||
Object.assign({}, ANALYZER_INPUTS, { animeSeries: 'Family Guy' }),
|
||||
{ originalLibraryFile: '/media/toshiba/Sonarr/Family.Guy.1999/Family.Guy.S00/Family.Guy.S00E64.mkv' });
|
||||
const o = await analyzerPlugin(a);
|
||||
eq(o.variables.isAnimation, 'true', 'Anime detected via originalLibraryFile in variables');
|
||||
cleanup(a); }
|
||||
|
||||
// Accents and apostrophe handling in anime list
|
||||
{ const a = makeArgs('/media/toshiba/Sonarr/Pokemon.S01E01.mkv',
|
||||
[makeStream({ r_frame_rate:'24/1', height:720 })],
|
||||
Object.assign({}, ANALYZER_INPUTS, { animeSeries: 'Pokémon' }));
|
||||
const o = await analyzerPlugin(a);
|
||||
eq(o.variables.isAnimation, 'true', 'Accented title "Pokémon" matches "Pokemon.S01E01.mkv"');
|
||||
cleanup(a); }
|
||||
|
||||
{ const a = makeArgs('/media/toshiba/Sonarr/Bobs.Burgers.S01E01.mkv',
|
||||
[makeStream({ r_frame_rate:'24/1', height:720 })],
|
||||
Object.assign({}, ANALYZER_INPUTS, { animeSeries: "Bob's Burgers" }));
|
||||
const o = await analyzerPlugin(a);
|
||||
eq(o.variables.isAnimation, 'true', 'Apostrophe title "Bob\'s Burgers" matches "Bobs.Burgers"');
|
||||
cleanup(a); }
|
||||
|
||||
// ── audioSelectorClamping ─────────────────────────────────────────────────
|
||||
console.log('\n── audioSelectorClamping ────────────────────────────');
|
||||
|
||||
@@ -246,6 +280,21 @@ const AUDIO_INPUTS = {
|
||||
eq(scalePassPercentage(2, 100), 100, 'pass 2 at 100% maps to 100%');
|
||||
ok(transcodeCode.includes('scalePassPercentage(1,'), 'pass 1 wraps updateWorker with 50% scale');
|
||||
ok(transcodeCode.includes('scalePassPercentage(2,'), 'pass 2 wraps updateWorker with 50% scale');
|
||||
ok(transcodeCode.includes("displayFile = (variables.originalLibraryFile || inputFile).replace(/\\\\/g, '/')"), 'transcode2PassX265 normalizes displayFile with forward slashes');
|
||||
ok(transcodeCode.includes('file: displayFile'), 'transcode2PassX265 passes displayFile to updateWorker');
|
||||
ok(transcodeCode.includes("'-metadata', `title=${baseName}`"), 'transcode2PassX265 restores metadata title tag in output MKV');
|
||||
ok(transcodeCode.includes("outFile = path.join(workDir, `${baseName}.${container}`).replace(/\\\\/g, '/')"), 'transcode2PassX265 normalizes outFile with forward slashes');
|
||||
|
||||
// Verify WebUI worker title logic: `t.file ? (e = t.file).includes("/") ? e.split("/").pop() : "" : ""`
|
||||
{
|
||||
const sampleWorkerFile = 'C:/media/toshiba/Sonarr/Family.Guy.1999/Family.Guy.S00/Family.Guy.S00E64.mkv';
|
||||
const webUiTitle = sampleWorkerFile ? (sampleWorkerFile.includes('/') ? sampleWorkerFile.split('/').pop() : '') : '';
|
||||
eq(webUiTitle, 'Family.Guy.S00E64.mkv', 'WebUI title extract works with forward slashes');
|
||||
|
||||
const sampleWindowsFile = 'C:\\media\\toshiba\\Sonarr\\Family.Guy.1999\\Family.Guy.S00\\Family.Guy.S00E64.mkv';
|
||||
const brokenWebUiTitle = sampleWindowsFile ? (sampleWindowsFile.includes('/') ? sampleWindowsFile.split('/').pop() : '') : '';
|
||||
eq(brokenWebUiTitle, '', 'Confirms WebUI bug: Windows backslashes produce empty title');
|
||||
}
|
||||
|
||||
// ── copyToWorkDir & replaceOriginalFile v1.0.0 checks ─────────────────────
|
||||
const copyPluginCode = require('fs').readFileSync(path.join(ROOT, 'LocalFlowPlugins/utility/copyToWorkDir/1.0.0/index.js'), 'utf8');
|
||||
|
||||
Reference in new issue
Block a user