Rename Audio file with an XML metadata info

Can be done with a rename script. Here's a demo. Probably needs a bit of fine-tuning to reliably pick the right lines.

// https://resource.dopus.com/t/rename-audio-file-with-an-xml-metadata-info/47799

var fsu = DOpus.FSUtil();
var stt = DOpus.Create().StringTools();

function OnGetNewName(getNewNameData) {
    if (getNewNameData.item.is_dir) return;

    var xmlPath = getNewNameData.item.realpath;
    xmlPath.ext = 'xml';
    if (!fsu.Exists(xmlPath)) return;

    var xmlItem = fsu.GetItem(xmlPath);
    var arr = stt.Decode(xmlItem.Open().Read(), 'utf8').split('\r\n');

    var tmpStem = arr[9] + ' - ' + arr[8];
    var tmpExt = getNewNameData.newname_ext;

    return tmpStem + tmpExt;
}

Save 47799.orp to   

%appdata%\GPSoftware\Directory Opus\Rename Presets

How to use Rename Presets from this forum

1 Like