Help for addon - display "track contained in playlists" directly

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: Help for addon - display "track contained in playlists" directly

Re: Help for addon - display "track contained in playlists" directly

by ekant » Thu Mar 21, 2024 5:17 pm

Hello Ludek,
thank you very much. I saw your answer just now (did not receive a notification...?).
I will try this and give a report, if and how it works.

Would be a big help to create new playlists (for freedance and meditation evenings) without repeating the favorite tracks too often.

Re: Help for addon - display "track contained in playlists" directly

by Ludek » Tue Feb 20, 2024 2:29 pm

OK, redefining the
window.uitools.tracklistFieldDefs.title.shortcutFunc
like this

Code: Select all


window.uitools.tracklistFieldDefs.title.shortcutFunc = function (item, shortcutID) {                 
        let list = app.playlists.getPlaylistsForTrackAsync(item);
        list.whenLoaded().then(() => {                                                           
            let retArray = [];
            list.locked(function () {                
                if (list.count == 0)
                    retArray.push({
                        title: _('No playlist found'),
                        icon: 'none'
                    });
                else
                    for (let index = 0; index < list.count; index++) {
                        let playlist = list.getValue(index);
                        let useIcon = 'playlist';
                        if (playlist.isAutoPlaylist)
                            useIcon = 'autoplaylist';
                        retArray.push({
                            title: playlist.name,
                            noAccessKey: true,
                            icon: useIcon,
                            playlist: playlist,
                            execute: function () {
                                navigationHandlers['playlist'].navigate(this.playlist);
                            },
                            order: index
                        });
                    }
            });                                                                                   
            let menu = new Menu(retArray);
            menu.show(window.mouseX, window.mouseY);
        });                                   
    }

will show the playlists once you click the shortcut arrow button next to track title in filelisting

Re: Help for addon - display "track contained in playlists" directly

by Ludek » Tue Feb 20, 2024 1:20 pm

Hi,
you can get inspired by showLinks addon https://www.mediamonkey.com/addons/brow ... how-links/

and in \Scripts\showLinks\controls\trackListView_add.js

you could use
getFindMoreFromSameMenuPlaylist (from uitools.js)
in the body of TrackListView.prototype.getShortcutContextMenu

to get the list of Playlists on right-click the shortcut..

Help for addon - display "track contained in playlists" directly

by ekant » Sun Feb 11, 2024 2:31 pm

Hello,
I'd like to try to write a first addon for MM5:
I would like to get the function of the context menu on a track "Find more of -> Playlists" more direct accessible.
E.g., a little icon (in a new row?) right to the track title - on Mouseover it should show all playlists containing the current track.

Any (little) help is very appreciated - as I am quite experienced in JS and programming, but never done anything in MM5 so far - seems to be quite complex :-)

How can I find/access the already existent dialog for displaying the required function (as described)?
How can I add a row/icon - and how to bind the action "showing the dialog" to the mouseover?

Thank you for your guide and time...

Top