Show mp3 genre in FOLDER InfoTip?

Hello,

I am trying to get Directory Opus to show the MP3-Genre tag already in the Folder InfoTipp.

Simply putting {mp3genre} in the Folder infoTipp does not work.

I understand it might be difficult due to the possibility of having different genres tagged in the folder.
But only reading out the genre from the first mp3 in one folder would be sufficient to me.

Is there a way to accomplish this?

Many thanks in advance,
Robert

You could do it with a custom script column but there's nothing built-in for that. Genre is a property of each music file, not the folder that contains them.

Okay, thanks for the info.
Unfortunately I cannot script...

This add-in should do what you want.

function OnInit(initData) {
    initData.name = 'FolderMp3Genre';
    initData.version = '2021-06-12';
    initData.copyright = '';
    initData.url = 'https://resource.dopus.com/t/show-mp3-genre-in-folder-infotipp/38688';
    initData.desc = '';
    initData.default_enable = true;
    initData.min_version = '12.0';
}

function OnAddColumns(addColData) {
    var col = addColData.AddColumn();
    col.name = 'FolderMp3Genre';
    col.label = 'FolderMp3Genre';
    col.header = 'FolderMp3Genre';
    col.justify = 'right';
    col.autogroup = true;
    col.method = 'OnColumn';
}

function OnColumn(scriptColData) {
    var item = scriptColData.item;
    if (!item.is_dir) return;
    if (item.path.drive == 0) return;

    var foundTag = false;
    var fsu = DOpus.FSUtil();
    var folderEnum = fsu.ReadDir(item);
    while (!folderEnum.complete) {
        var folderItem = folderEnum.Next();
        if (folderItem.metadata == 'audio') {
            var genre = folderItem.metadata.audio.mp3genre;
            if (genre == '') continue;
            foundTag = true;
            break;
        }
    }

    scriptColData.value = foundTag ? genre : 'no audio file inside';
}

ColumnFolderMp3Genre.js.txt (1.2 KB)

How to

How to use buttons and scripts from this forum

2 Likes

@lxp: Many thanks! It works like a charm and exactly like needed :slightly_smiling_face:

This kind of support is why Directory Opus is truely great!