HowTo get selected songs

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

Moderator: jiri

HowTo get selected songs

Postby crap_inhuman » Tue Feb 07, 2017 8:53 pm

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
crap_inhuman
 
Posts: 490
Joined: Sat Jan 26, 2013 6:00 am
Location: Friedberg / Hessen / Germany

Re: HowTo get selected songs

Postby PetrCBR » Wed Feb 08, 2017 6:09 am

Code: Select all
var tracklist = uitools.getSelectedTracklist();
PetrCBR
 
Posts: 1330
Joined: Tue Mar 07, 2006 5:31 pm
Location: Czech

Re: HowTo get selected songs

Postby djdd » Wed Feb 08, 2017 3:43 pm

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
djdd
 
Posts: 40
Joined: Mon Dec 26, 2016 3:36 pm
Location: Switzerland, Breitenbach

Re: HowTo get selected songs

Postby crap_inhuman » Thu Feb 09, 2017 3:06 am

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
crap_inhuman
 
Posts: 490
Joined: Sat Jan 26, 2013 6:00 am
Location: Friedberg / Hessen / Germany

Re: HowTo get selected songs

Postby PetrCBR » Thu Feb 09, 2017 7:51 am

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 ''; }();')
PetrCBR
 
Posts: 1330
Joined: Tue Mar 07, 2006 5:31 pm
Location: Czech

Re: HowTo get selected songs

Postby crap_inhuman » Thu Feb 09, 2017 2:42 pm

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
crap_inhuman
 
Posts: 490
Joined: Sat Jan 26, 2013 6:00 am
Location: Friedberg / Hessen / Germany

Re: HowTo get selected songs

Postby Ludek » Thu Feb 09, 2017 3:27 pm

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/)
Ludek
 
Posts: 2213
Joined: Fri Mar 09, 2007 9:00 am

Re: HowTo get selected songs

Postby PetrCBR » Thu Feb 09, 2017 3:48 pm

As i wrote, asJSON property will be introduced in next release.
PetrCBR
 
Posts: 1330
Joined: Tue Mar 07, 2006 5:31 pm
Location: Czech


Return to MediaMonkey 5 developer forum

Who is online

Users browsing this forum: No registered users and 2 guests