HowTo get selected songs

To discuss development of addons / skins / customization of MediaMonkey.

Moderator: jiri

crap_inhuman
Posts: 780
Joined: Sat Jan 26, 2013 6:00 am
Location: Friedberg / Hessen / Germany
Contact:

HowTo get selected songs

Post by crap_inhuman »

How can i get the selected songs through api ?

Using the well-known SDB.SelectedSongList return no result
Metal up your ass !
-----------------------------------------------
I added my first 2 videos on youtube. The language is german.

Discogs Autorisierung: https://www.youtube.com/watch?v=oryxKKtnEnc
Discogs Tagger Bedienung: https://www.youtube.com/watch?v=85Wk-5rd-W0
PetrCBR
Posts: 1701
Joined: Tue Mar 07, 2006 5:31 pm
Location: Czech
Contact:

Re: HowTo get selected songs

Post by PetrCBR »

Code: Select all

var tracklist = uitools.getSelectedTracklist();
djdd
Posts: 40
Joined: Mon Dec 26, 2016 3:36 pm
Location: Switzerland, Breitenbach
Contact:

Re: HowTo get selected songs

Post by djdd »

An example can be found in the SampleScript "fixTrailingThe", local.js, line 234, that also Show how to handle the Situation, if nothing was selected

Code: Select all

trackList = uitools.getSelectedTracklist()
if (!trackList || trackList.count == 0) {

    trackList = uitools.getTracklist()
}

if (!trackList || trackList.count == 0) {
    res = messageDlg("Select tracks to be updated", 'Error', ["btnOK"], {}, function(){})
    return
}
Regards,
Dieter
crap_inhuman
Posts: 780
Joined: Sat Jan 26, 2013 6:00 am
Location: Friedberg / Hessen / Germany
Contact:

Re: HowTo get selected songs

Post by crap_inhuman »

Thank you for your answers.

Is it possible with the COM interface, too?
Metal up your ass !
-----------------------------------------------
I added my first 2 videos on youtube. The language is german.

Discogs Autorisierung: https://www.youtube.com/watch?v=oryxKKtnEnc
Discogs Tagger Bedienung: https://www.youtube.com/watch?v=85Wk-5rd-W0
PetrCBR
Posts: 1701
Joined: Tue Mar 07, 2006 5:31 pm
Location: Czech
Contact:

Re: HowTo get selected songs

Post by PetrCBR »

From COM interface you can get the tracks as JSON string using asJSON property (will be introduced in next build):

Code: Select all

tracks = SDB.runJSCode('function(){ var list = uitools.getSelectedTracklist(); if(!list || !list.count) list = uitools.getTracklist(); if(list) return list.asJSON; return ''; }();')
crap_inhuman
Posts: 780
Joined: Sat Jan 26, 2013 6:00 am
Location: Friedberg / Hessen / Germany
Contact:

Re: HowTo get selected songs

Post by crap_inhuman »

I try to convert the Discogs Tagger using Autoit3 scripting language - the script interact with MM using the COM interface. Works perfect with MM4. To get the script working with MM5 i need a COM interface as in MM4. This script is already finished.

Using the following code didn't return a object, so i would have to change the whole script.

Code: Select all

tracks = SDB.runJSCode('function(){ var list = uitools.getSelectedTracklist(); if(!list || !list.count) list = uitools.getTracklist(); if(list) return list.asJSON; return ''; }();')


I try to convert the script using the VBS2JS converter, too... But i don't know, if i can get it work sometime.
Metal up your ass !
-----------------------------------------------
I added my first 2 videos on youtube. The language is german.

Discogs Autorisierung: https://www.youtube.com/watch?v=oryxKKtnEnc
Discogs Tagger Bedienung: https://www.youtube.com/watch?v=85Wk-5rd-W0
Ludek
Posts: 3414
Joined: Fri Mar 09, 2007 9:00 am
Contact:

Re: HowTo get selected songs

Post by Ludek »

Re: Discogs Tagger

You might want to look at [MM5 install folder]/SampleScripts/customWebTagger.mmip (after install the sources will be in [MM5 install folder]/Scripts/customWebTagger/)
PetrCBR
Posts: 1701
Joined: Tue Mar 07, 2006 5:31 pm
Location: Czech
Contact:

Re: HowTo get selected songs

Post by PetrCBR »

As i wrote, asJSON property will be introduced in next release.
Post Reply