monitoring current track without on_play

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

Moderator: Gurus

jiri
Posts: 5392
Joined: Tue Aug 14, 2001 7:00 pm
Location: Czech Republic
Contact:

Re: monitoring current track without on_play

Post by jiri » Thu Jan 22, 2009 5:11 am

Based on the list posted by ZvezdanD here: http://www.mediamonkey.com/forum/viewto ... 31#p186831 there were many new events added in MM 3.1.0.1218. They are:

A2. New events OnDblClick, OnEnter, OnExit.
A4. New events OnShuffleClicked, OnRepeatClicked and OnNowPlayingModified.
A6. New events OnTrackListSelectionChanged and OnNowPlayingSelectionChanged.
A9. New event OnTrackEnd.
B1. New OnIdle event.
B5. New events OnOptionsChange and OnFilterChange.
B7. New events OnTrackListFilling and OnTrackListFilled.

Jiri

ZvezdanD
Posts: 3090
Joined: Thu Jun 08, 2006 7:40 pm

Re: monitoring current track without on_play

Post by ZvezdanD » Thu Jan 22, 2009 5:39 am

Jiri, thank you so much!
Magic Nodes 4.3.3 / 5.2 RegExp Find & Replace 4.4.9 / 5.2  Invert Selection/Select None 1.5.1  Export/Create Playlists for Child Nodes 4.1 / 5.4  Expand Child Nodes/Expand All 1.1.2  Event Logger 2.7  Filtered Statistics Report 1.6  Track Redirection & Synchronization 3.4.2  Restore/Synchronize Database 3.1.7 / 4.0  Find Currently Playing Track 1.3.2  Queue List 1.2.1  Add to Library on Play 1.0.1  Tree Report for Child Nodes 1.1.1  Update Location of Files in Database 1.4.3 / 2.2.2  Inherit Child Playlists 1.0.2  Add Currently Playing/Selected Track(s) to Playlist 1.1.2

ZvezdanD
Posts: 3090
Joined: Thu Jun 08, 2006 7:40 pm

Re: monitoring current track without on_play

Post by ZvezdanD » Thu Jan 22, 2009 6:10 am

jiri wrote:A6. New events OnTrackListSelectionChanged and OnNowPlayingSelectionChanged.
Jiri, all of this added events are self explanatory, but I am not sure about OnTrackListSelectionChanged. Could you tell me if it fires when a selected (highlighted as someone is calling it) state are changed or whenever is some track added/removed?

If it means only on selected state, then this is not same as DaledeSilva's requests. Here is his post:
currently, previously OnChangedSelection has let a script know whenever the tracklist has changed because it usually only changes when a new node is navigated to.

Now, however, because a user can set search to "Current Selection" the tracklist can change without changing nodes and OnChangedSelection doesn't report (logically).

I would like a specific OnChange event for the tracklist window.
I think that you introduced too much confusion with a term "Current Selection" as it is posted by chrisjj in http://www.mediamonkey.com/forum/viewto ... =4&t=35966. To me a term "Selection" is about selected (highlighted) state of tracks, not their visible state.
Magic Nodes 4.3.3 / 5.2 RegExp Find & Replace 4.4.9 / 5.2  Invert Selection/Select None 1.5.1  Export/Create Playlists for Child Nodes 4.1 / 5.4  Expand Child Nodes/Expand All 1.1.2  Event Logger 2.7  Filtered Statistics Report 1.6  Track Redirection & Synchronization 3.4.2  Restore/Synchronize Database 3.1.7 / 4.0  Find Currently Playing Track 1.3.2  Queue List 1.2.1  Add to Library on Play 1.0.1  Tree Report for Child Nodes 1.1.1  Update Location of Files in Database 1.4.3 / 2.2.2  Inherit Child Playlists 1.0.2  Add Currently Playing/Selected Track(s) to Playlist 1.1.2

jiri
Posts: 5392
Joined: Tue Aug 14, 2001 7:00 pm
Location: Czech Republic
Contact:

Re: monitoring current track without on_play

Post by jiri » Thu Jan 22, 2009 7:34 am

OnTrackListSelectionChanged is fired when a track is selected or unselected in the tracklist. Note that this and all other new events are already documented in Wiki.

It seems that you are right, it doesn't really comply the original request. That said, as I test the current events, either these or for example OnTrackListFilled, it seems that they cover all necessities. In case there is some scenario missed, I'm open for adding some more events.

As for "Current Selection" term in UI - yes, it can cause some confusion, but as discussed in the thread, it's hard to find a good replacement. As for programmers/scripters, I suppose that terms like selection and focus and quite clear and well defined.

Jiri

ZvezdanD
Posts: 3090
Joined: Thu Jun 08, 2006 7:40 pm

Re: monitoring current track without on_play

Post by ZvezdanD » Thu Jan 22, 2009 7:43 am

jiri wrote:OnTrackListSelectionChanged is fired when a track is selected or unselected in the tracklist.
Good to know that. I like to have such event, even if I don't need it in this moment.

You are right, it seems that OnTrackListFilled could be used in DaledeSilva's case.
Magic Nodes 4.3.3 / 5.2 RegExp Find & Replace 4.4.9 / 5.2  Invert Selection/Select None 1.5.1  Export/Create Playlists for Child Nodes 4.1 / 5.4  Expand Child Nodes/Expand All 1.1.2  Event Logger 2.7  Filtered Statistics Report 1.6  Track Redirection & Synchronization 3.4.2  Restore/Synchronize Database 3.1.7 / 4.0  Find Currently Playing Track 1.3.2  Queue List 1.2.1  Add to Library on Play 1.0.1  Tree Report for Child Nodes 1.1.1  Update Location of Files in Database 1.4.3 / 2.2.2  Inherit Child Playlists 1.0.2  Add Currently Playing/Selected Track(s) to Playlist 1.1.2

ZvezdanD
Posts: 3090
Joined: Thu Jun 08, 2006 7:40 pm

Re: monitoring current track without on_play

Post by ZvezdanD » Thu Jan 22, 2009 7:56 am

Jiri, just one more question about OnTrackListSelectionChanged. I just tried it and I have following scenario:
1. click on some node which has tracks, tracklist is populated with those tracks, first track is selected by MM automatically and mentioned event fires.
2. click on some another node which also has tracks -> everything is same as in previous case.
3. click on some node which don't contain any track -> tracklist is empty and mentioned event doesn't fires.

I think it should fire in the third case too, since selection is changed as it is in the second case.
Magic Nodes 4.3.3 / 5.2 RegExp Find & Replace 4.4.9 / 5.2  Invert Selection/Select None 1.5.1  Export/Create Playlists for Child Nodes 4.1 / 5.4  Expand Child Nodes/Expand All 1.1.2  Event Logger 2.7  Filtered Statistics Report 1.6  Track Redirection & Synchronization 3.4.2  Restore/Synchronize Database 3.1.7 / 4.0  Find Currently Playing Track 1.3.2  Queue List 1.2.1  Add to Library on Play 1.0.1  Tree Report for Child Nodes 1.1.1  Update Location of Files in Database 1.4.3 / 2.2.2  Inherit Child Playlists 1.0.2  Add Currently Playing/Selected Track(s) to Playlist 1.1.2

jiri
Posts: 5392
Joined: Tue Aug 14, 2001 7:00 pm
Location: Czech Republic
Contact:

Re: monitoring current track without on_play

Post by jiri » Thu Jan 22, 2009 10:33 am

Well, it depends on how you look on it, internally it works so that the items are first destroyed and so they don't lose select status. However, you can use OnChangedSelection event which is fired anytime anything changes in MM UI (focused control, selected items, etc.) and this actually is a superset of OnTrackListSelectionChanged event.

Jiri

Teknojnky
Posts: 5533
Joined: Tue Sep 06, 2005 11:01 pm
Contact:

Re: monitoring current track without on_play

Post by Teknojnky » Thu Jan 22, 2009 11:02 am

Thanks for the events and feedback Jiri!

raybeau528
Posts: 401
Joined: Thu Sep 27, 2007 4:19 pm
Location: Connecticut

Re: monitoring current track without on_play

Post by raybeau528 » Thu Jan 22, 2009 1:51 pm

I also want to say thanks for all these great events!!!

Ray

ZvezdanD
Posts: 3090
Joined: Thu Jun 08, 2006 7:40 pm

Re: monitoring current track without on_play

Post by ZvezdanD » Thu Jan 22, 2009 3:13 pm

Jiri, I have one more request. I need OnMouseDown and OnMouseUp events, especially needed for the button controls. In my scripts I have two buttons, "Up" and "Down", for moving items in a list. I need to click for every item to traverse through list which is really boring, especially for longer movements. If I have OnMouseDown/OnMouseUp, I could click on specific button just once, like with the up/down (spin) control.

Well, when I think more about it, I need also OnKeyDown and OnKeyUp for same purpose. And please don't forget about OnSelect event for Edit/MultilineEdit controls.
Magic Nodes 4.3.3 / 5.2 RegExp Find & Replace 4.4.9 / 5.2  Invert Selection/Select None 1.5.1  Export/Create Playlists for Child Nodes 4.1 / 5.4  Expand Child Nodes/Expand All 1.1.2  Event Logger 2.7  Filtered Statistics Report 1.6  Track Redirection & Synchronization 3.4.2  Restore/Synchronize Database 3.1.7 / 4.0  Find Currently Playing Track 1.3.2  Queue List 1.2.1  Add to Library on Play 1.0.1  Tree Report for Child Nodes 1.1.1  Update Location of Files in Database 1.4.3 / 2.2.2  Inherit Child Playlists 1.0.2  Add Currently Playing/Selected Track(s) to Playlist 1.1.2

trixmoto
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK
Contact:

Re: monitoring current track without on_play

Post by trixmoto » Fri Jan 23, 2009 4:29 am

Thanks, you seem to have covered all the bases (and a few more!) :)
Download my scripts at my own MediaMonkey fansite.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.

Post Reply