Events fired by Now Playing??

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

Moderator: Gurus

Events fired by Now Playing??

Postby technofool » Sun Jun 26, 2016 7:16 am

I'm trying to VBscript a panel that lists all Genres of the currently playing song. When the next song starts I want to update the list of Genres in the panel for the song that has just started.

What trigger event should I use in VBScript?
Where can I see a list of events generated by MM?
I'm using Notepad++ as my IDE.

The long term plan for my addon is to add a Genre "Workout" to the Now Playing song. This way I can later sync individually chosen tracks to my phone for exercise listening. Better than syncing whole albums to the phone if I only really enjoy 1 or 2 tracks from that album.
Right now I want the panel to show me if the currently playing song already contains the "Workout" genre, then I can add it or delete it by clicking on the checkbox in the panel.

Hopefully I can build up a list of really motivational songs to help with exercise :D

Code: Select all
Sub OnSelection
   'read Genres and populate on Panel
   'onselect and onsongchange
'   Lbl.Caption = "Selected tracks: " & SDB.CurrentSongList.Count
   Lbl.Caption = "Current Song: " & SDB.Player.CurrentSong.Title
   ChB.Checked = CBool(InStr(SDB.Player.CurrentSong.Genre, ChB.Caption))
'   ChB.Checked = not chb.checked
 
End Sub
technofool
 
Posts: 4
Joined: Fri Jul 16, 2010 10:06 am

Re: Events fired by Now Playing??

Postby mcow » Thu Jun 30, 2016 9:07 pm

The list of events is in the second table at the SDBApplication API page. OnPlay is issued at the beginning of play for each track; OnPlaybackEnd is issued at the end of play for each track.
mcow
 
Posts: 813
Joined: Sun Sep 21, 2008 9:35 pm
Location: Cupertino, California

Re: Events fired by Now Playing??

Postby technofool » Fri Jul 01, 2016 2:33 pm

Thank you mcow, that is exactly the info I was struggling to find. OnPlay is not clear that it fires every time a song starts and not just at 'play button' press. (I live and learn :-)

What do you think of my method to get my favorite tracks onto my phone for exercise sessions or overriding the insipid mall music when I'm shopping? I'm using a "Workout" Genre to sync my chosen tracks to my phone but there must be other ways, possibly easier.

New problem now, I want my "Workout" checkbox to be ticked if the currently playing song already has a genre "Workout". When the new song starts in the Playlist and I try to set the checkbox to reflect the Genre of the song now playing it fires the OnClick event as if I just clicked the checkbox to change the value. How do I set the checkbox tick without firing the OnClick event?
technofool
 
Posts: 4
Joined: Fri Jul 16, 2010 10:06 am

Re: Events fired by Now Playing??

Postby mcow » Sun Jul 03, 2016 6:43 pm

technofool wrote:What do you think of my method...?


Genre seems as good a technique as any. Playlist would be another way.

technofool wrote:New problem now, I want my "Workout" checkbox to be ticked if the currently playing song already has a genre "Workout". When the new song starts in the Playlist and I try to set the checkbox to reflect the Genre of the song now playing it fires the OnClick event as if I just clicked the checkbox to change the value. How do I set the checkbox tick without firing the OnClick event?


I think you can't disable the event firing when you check the box, but you could set a flag "Program updating now" and have all the event handlers check the flag and do nothing if it's set; then clear it when the update is complete.
mcow
 
Posts: 813
Joined: Sun Sep 21, 2008 9:35 pm
Location: Cupertino, California

Re: Events fired by Now Playing??

Postby technofool » Sun Jul 03, 2016 8:55 pm

Thank you, no wonder I was struggling. If you can't tick and untick a checkbox without firing the event I will never find the solution, I will implement your global flag solution, makes sense to me.
technofool
 
Posts: 4
Joined: Fri Jul 16, 2010 10:06 am

Re: Events fired by Now Playing??

Postby technofool » Thu Jul 28, 2016 7:17 pm

OK I have my script working now and I have over 500 songs tagged with Genre = Workout.
I would like to add a feature where OnSongChange the TracksWindow (showing Genre = Workout) is synchronized with the Now Playing Artist from the Now Playing window. This will let me see if I already have that song tagged or if I have other songs from that artist in the Genre list.

I have Set objTracksWindow = SDB.MainTracksWindow but I don't know how to scroll the Genre TracksWindow to the same artist as the current playing song.

Any suggestions please?
technofool
 
Posts: 4
Joined: Fri Jul 16, 2010 10:06 am


Return to MediaMonkey 4 Addons developer forum

Who is online

Users browsing this forum: No registered users and 4 guests