Find a track and play it

This forum is for questions / discussions regarding development of addons / tweaks for MediaMonkey for Windows 4.

Moderators: Gurus, Addon Administrators

Formidable
Posts: 5
Joined: Mon Apr 18, 2011 9:53 am

Find a track and play it

Post by Formidable »

Good morning!
I'm playing with a bit of MM automation using visual basic and I've hit a wall.
What I'm trying to accomplish doesn't seem as if it should be that difficult, but I'm stumped.
This, simply, is what I want to do in code:
First: Select a song from the library. (This I can do easily enough.)
Second: Play the track. I can't seem to find an easy way to do this. Am I missing something?
I can add or insert the track to the "Now Playing" list. I can focus and select the track.
But the only way I can find of actually playing the track is to iterate through the "Now Playing" list using Next or Prev until the current track is the track I want. There must be an easier way, right?

Anyone have an Idea?
Am I missing something obvious?

PS: I tried posting this same issue yesterday, but I don't see my post anywhere. Perhaps I did that wrong too?
Eyal
Posts: 3118
Joined: Sun Jun 26, 2005 9:27 am
Location: Québec
Contact:

Re: Find a track and play it

Post by Eyal »

Hi,

I suppose you can get trough it by using

Code: Select all

SDB.Player.PlaylistFocused = x
where x is the index in the Playing list.

Ref.: http://www.mediamonkey.com/wiki/index.p ... stSelected

:~)
Skins for MediaMonkey: Cafe, Carbon, Helium, Spotify, Zekton. [ Wiki Zone ].
Formidable
Posts: 5
Joined: Mon Apr 18, 2011 9:53 am

Re: Find a track and play it

Post by Formidable »

Thanks for the reply.
You're correct, "Playlistfocused = X" will indeed switch focus to track x.
But that's it. So, the track title has focus in the playlist. That won't make it play.
You can use "Playlistfocused = X" to give the track focus and then send "Play" to the player.
You'd think that would work, right? It doesn't.

What DOES work, I've discovered is this:
Changing the "CurrentSongIndex" of the player.
"mmplayer.CurrentSongIndex = x" will indeed make the song at index x the currently playing track.
The player doesn't really seem to care which track in the list has focus.

Please, someone double-check me on this.

Thanks!
Post Reply