Show mp3 genre in FOLDER InfoTip?

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