Copy music metadata to clipboard

I see that we have the option to copy file names (for example with Clipboard COPYNAMES=nopaths). Is there an easy way to copy the metadata of a music file? In particular the track length?

I know similar questions have been asked before, but no real example as been provided and I would love some clarification if possible.

Of just one file? Hover over it until the infotip appears, then push Ctrl + Shift + C to copy the information in the infotip to the 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

I was actually thinking about multiple files, but that is a great tip! I didn't know you could do that :astonished:

Thanks!

I am not very script savy, but I assume we can use all keywords?

Now I will just have to find a way to make it display the duration as minutes:seconds. But this helps a lot to get started.

By the way, now that I think of it, it would be really cool to be able to save "Print Folder Contets" presets. Think of it as a feature request :wink: