Copy music metadata to clipboard

This will copy mp3songlength of all selected files into the clipboard. Values will be in seconds.

function OnClick(clickData) {
    var tab = clickData.func.sourcetab;

    var result = '';

    for (var e = new Enumerator(tab.selected_files); !e.atEnd(); e.moveNext()) {
        var item = e.item();
        var tmp = item.metadata.audio.mp3songlength;
        if (typeof tmp == 'undefined') continue;
        result += tmp + '\n';
    }

    if (result == '') return;

    DOpus.SetClip(result);
}

Song Length.dcf (1.2 KB)


1 Like