Checking audio successfully converted - finding duplicate audio length in different formats

Posting is fine with me, please zip the files so the forum doesn't mess with the metadata.

WHAT IS IT.zip (12.9 MB)

Looks okay here.

Did you change the line? Should look like this:

var destItem = fsu.GetItem(dtab.path + '\\' + item.name_stem + '.opus');

I believe I changed the line, I'll double check

function OnInit(initData) {
    initData.name = 'CompareDuration';
    initData.version = '2024-03-29';
    initData.url = 'https://resource.dopus.com/t/checking-audio-successfully-converted-finding-duplicate-audio-length-in-different-formats/49963';
    initData.desc = '';
    initData.default_enable = true;
    initData.min_version = '12.0';
}

function OnAddColumns(addColData) {
    var col = addColData.AddColumn();
    col.name = 'CompareDuration';
    col.method = 'OnColumn';
    col.type = 'double';
}

function OnColumn(scriptColData) {
    scriptColData.value = -999;
    var item = scriptColData.item;
    if (item.is_dir) return;

    var dtab = scriptColData.tab.lister.desttab;
    if (!dtab) return;
    if (!dtab.path) return;

    var fsu = DOpus.FSUtil();
    var destItem = fsu.GetItem(dtab.path + '\\' + item.name_stem + '.opus');
    if (!fsu.Exists(destItem)) return;
    if (item.metadata != 'audio') return;
    if (destItem.metadata != 'audio') return;

    var gap = item.metadata.audio.duration - destItem.metadata.audio.duration;
    if (typeof gap != 'number') return;
    if (gap < 0) gap = -gap;
    scriptColData.value = gap;
}

Looks like the line is changed correctly, I think

Expandable folders are like Flat View - the script won't find the .opus files.

So, how do I compare 1000s of files in various sub-directories all at once?

BTW, is there no match by duration and filename (but not file type) in the Duplicate Finder of Dir Opus 13?

Teach the script to find the .opus files based on the .mp3 files. Currently, that's done with the line already mentioned. Can you think of a string manipulation or regex?

So teach it to look inside all sub-folders not just the main folder and match them up with identical sub-folder names in the .opus converted directory?

I'd assume the files are in structure like this

D:\original\folder\subfolder\file.mp3
D:\converted\folder\subfolder\file.opus

So there is no need for a search, just a simple string conversion to find the matching .opus file.

Yes, That is how the files are organized.

How do I do "a simple string conversion"?
Sorry but I really don't know much programming type stuff

Replace the line with these:

var newPath = String(item.path).replace('D:\\original', 'D:\\converted');
var newStem = item.name_stem;
var newExt = '.opus';

var destItem = fsu.GetItem(newPath + '\\' + newStem + newExt);

Use double backslashes when editing the paths D:\\....