External Tools for MM5

Post a reply

Smilies
:D :) :( :o :-? 8) :lol: :x :P :oops: :cry: :evil: :roll: :wink:

BBCode is ON
[img] is ON
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: External Tools for MM5

Re: External Tools for MM5

by Ludek » Fri Apr 08, 2022 12:14 pm

Alternativelly use this:

Code: Select all

uitools.findMoreMenuActions.xyplorerFolder = {
            getMenuItems: function (track) {
                if (!_utils.isRemoteTrack(track))
                    return [{
                        title: function () {
                            return _('Folder') + ' (XYplorer)';
                        },
                        icon: 'folder',
                        execute: function () {
                        	    bindAction( actions.openFolderXYplorer,  track).execute();	
                        },
                        order: 90
                    }];
            }
        }
And in the execute method of action openFolderXYplorer you can access the track via this.boundObject.
So the path to open will be this.boundObject.path

Re: External Tools for MM5

by tbm72 » Thu Apr 07, 2022 1:19 pm

drakinite wrote: Thu Apr 07, 2022 1:13 pm Took a bit to find, but it looks like it's defined in uitools.findMoreMenuActions.explorerFolder. It's a bit more complicated than adding to an array in window._menuItems.x. More info on the override method here: https://www.mediamonkey.com/wiki/Import ... )#Override

Code: Select all

uitools.findMoreMenuActions.explorerFolder.override({
    getMenuItems: function($super, track) {
        var ret = $super(track);
        ret.push({
            title: 'Hello World',
            icon: 'folder',
            execute: function () {
                console.log('Hello World');
            },
            order: 99
        });
        return ret;
    }
});
Change the title, icon, execute, and order inside of that ret.push statement to whatever you like. You could also change it to ret.push(actions.openFolderXYplorer); if you want.
Thanks so much for looking into that Drakinite, really appreciate your help. I'll have a good look through that later :)

Re: External Tools for MM5

by drakinite » Thu Apr 07, 2022 1:13 pm

Took a bit to find, but it looks like it's defined in uitools.findMoreMenuActions.explorerFolder. It's a bit more complicated than adding to an array in window._menuItems.x. More info on the override method here: https://www.mediamonkey.com/wiki/Import ... )#Override

Code: Select all

uitools.findMoreMenuActions.explorerFolder.override({
    getMenuItems: function($super, track) {
        var ret = $super(track);
        ret.push({
            title: 'Hello World',
            icon: 'folder',
            execute: function () {
                console.log('Hello World');
            },
            order: 99
        });
        return ret;
    }
});
Change the title, icon, execute, and order inside of that ret.push statement to whatever you like. You could also change it to ret.push(actions.openFolderXYplorer); if you want.

Re: External Tools for MM5

by tbm72 » Thu Apr 07, 2022 7:06 am

This is great Andre! I've managed to use your code to get an option which opens a selected track in XYplorer which is just what I'm after. The last step I'm stuck on is getting the option to appear under the 'Find more from same>' submenu when I right-click a track.

My slightly edited version of your code at the moment contains this:

Code: Select all

window._menuItems.editTags.action.submenu.push({
        action: actions.openFolderXYplorer,
        order: 1,
        grouporder: 2
});
Which works great but it puts the option as the first entry under the 'Edit Tags>' submenu. What I'd like is for it to be at the bottom of the 'Find more from same>' submenu. I've been reading through the 'Getting Started (Addons)' help page and also tried to decipher the 'actions.js' file but I can't quite find the right code to get it placed under that submenu option. I've tried things like:

Code: Select all

window._menuItems.findMoreFromSame.action.submenu.push
But I just get an error. I'm happy to admit I know nothing about coding but I think I'm almost there! Can anyone give me the final hint to get this code placed under the 'Find more From' submenu?

Re: External Tools for MM5

by Andre_H » Thu Apr 07, 2022 1:29 am

Mail is on the way.

(I guess PM stay in outbox until the Receiver gets them)

Re: External Tools for MM5

by tbm72 » Wed Apr 06, 2022 5:48 pm

Thanks Andre, I seem to have a problem sending PMs for some reason - they just get put in my Outbox but not sent. I'll try again tomorrow.

Re: MMW5 Addon & Skin Requests

by Andre_H » Wed Apr 06, 2022 5:26 pm

tbm72 wrote: Wed Apr 06, 2022 4:03 pm Sorry for the stupid question but how do I go about getting this code into MM? Do I need to look at the scripts folder or does it involve coding as an addon?
it's a subfolder under "scripts". if you PM me a mail adress, i can zip and send you the files, it's just 6files and 24kB at all.

Re: External Tools for MM5

by drakinite » Wed Apr 06, 2022 4:24 pm

Hey guys, FYI I split these two posts off the Addon & Skin Requests thread to keep it on topic.

Re: MMW5 Addon & Skin Requests

by tbm72 » Wed Apr 06, 2022 4:03 pm

Andre_H wrote: Wed Apr 06, 2022 11:37 am As an example how to open external tools (MP3Tag here):
This looks very promising thanks! Sorry for the stupid question but how do I go about getting this code into MM? Do I need to look at the scripts folder or does it involve coding as an addon?

Happy to experiment if someone can point me in the right direction!

External Tools for MM5

by Andre_H » Wed Apr 06, 2022 11:37 am

As an example how to open external tools (MP3Tag here):

Code: Select all

//* open file or folder of selected track in MP3Tag.*//
// variables ...
var AppPath = "\\\\YourServer\\YourShare\\Mp3Tag\\MP3Tag.exe" 
//var AppPath == "X:\\YourFolder\\Mp3Tag\\MP3Tag.exe"

actions.openFileMP3Tag = {
    title: _('Open track in MP3Tag ...'),
    icon: 'openMP3Tag',
    disabled: uitools.notMediaListSelected,
    visible: window.uitools.getCanEdit,
    execute: async function () {	
	var list = await uitools.getSelectedTracklist().whenLoaded();
        
	if (list.count === 0) {
            return;
        }

        list.forEach(function(itm) {
		var AppParameters = '/fn:"' + itm.path + '"'
		app.utils.shellExecute(AppPath, AppParameters)	
        });       
    }
}

actions.openFolderMP3Tag = {
    title: _('Open track folder in MP3Tag ...'),
    icon: 'openMP3Tag',
    disabled: uitools.notMediaListSelected,
    visible: window.uitools.getCanEdit,
    execute: async function () {	
	var list = await uitools.getSelectedTracklist().whenLoaded();
        
	if (list.count === 0) {
            return;
        }

        list.forEach(function(itm) {
		var AppParameters = '/fp:"' + itm.path + '"'
		app.utils.shellExecute(AppPath, AppParameters)	
        });       
    }
}

window._menuItems.editTags.action.submenu.push({
        action: actions.openFileMP3Tag,
        order: 1,
        grouporder: 2
});

window._menuItems.editTags.action.submenu.push({
        action: actions.openFolderMP3Tag,
        order: 2,
        grouporder: 2
});
Credits to all the guys in the addon subforum, I just jingled it together following the instructions from there.
It's nowhere near the same as the addon linked above, but possibly an approach.

Top