View Issue Details

IDProjectCategoryView StatusLast Update
0018998MMW 5Extensions frameworkpublic2022-05-25 16:39
Reporterzvezdan Assigned To 
PriorityurgentSeverityminorReproducibilityN/A
Status closedResolutionreopened 
Product Version5.0.3 
Target Version5.0.3Fixed in Version5.0.3 
Summary0018998: Playlist event handlers are incorectly stated in API, some are missing, some are unuseful
DescriptionThe old OnPlaylistChanged is not replaced with 'playlistChanged' as it is used in VBStoJS, but with 'playlistchange'. API is correct.

The old OnPlaylistRemoved is indeed replaced with 'playlistRemoved' as it is in VBStoJS, but it is nowhere mentioned in API.

The old OnPlaylistAdded has no functional replacement; the 'playlistAdded' can be registered, but it doesn't fire at all. Not mentioned in API either.

The playlistRemoved event handler should have the playlist object as an argument as it was in MM4, not the playlist's id. I used its object in my add-ons to display the title of the removed playlists and for other things.
TagsNo tags attached.
Fixed in build2617

Activities

drakinite

2022-04-24 22:04

developer   ~0067740

Last edited: 2022-04-24 22:11

Went through all native events and updated their documentation to reflect the correct event name.

- playlistChange event on the App object is new.
- playlistChanged, playlistRemoved, and playlistAdded events are tied to the Playlist class, to be accessed via app.playlists.root unless you want to deal with child playlists. Added them to the API documentation.
- You can use app.playlists.getByIDAsync (https://www.mediamonkey.com/docs/api/classes/Playlists.html#method_getByIDAsync) to get a playlist from its ID.
- Confirmed that playlistAdded does not fire as expected. To be fixed in build 2617.

zvezdan

2022-04-24 22:38

updater   ~0067741

When you mentioned app.playlists.getByIDAsync, did you mean on playlistRemoved? Since that doesn't work, it returns undefined. Otherwise I wouldn't reported the issue.

zvezdan

2022-04-24 22:57

updater   ~0067742

And just for your information, I tried also app.db.getQueryResultAsync('SELECT * FROM Playlists WHERE IDPlaylist = ' + plsId) without success.

drakinite

2022-04-25 01:15

developer   ~0067748

Re "When you mentioned app.playlists.getByIDAsync, did you mean on playlistRemoved? Since that doesn't work, it returns undefined. Otherwise I wouldn't reported the issue.":

Good point. Assigning to Ludek to triage the suggestion of making playlistRemoved return the playlist information instead of its ID, as the ID is useless in that case.

Ludek

2022-04-25 14:49

developer   ~0067763

Last edited: 2022-04-25 15:02

Fixed in 2617.

'playlistAdded' is now fired on proper parent + also bubbles. So any new playlist can be listened either on app.playlists.root (or a possible sub-parent -- once it is deeper in the hierarchy)
'playlistRemoved' has the playlist object as parameter now (not just id)

peke

2022-05-01 16:18

developer   ~0067898

Verified 2619

Using small test script sample.

Test Note:
'playlistAdded' Tested up to 4th sub-parrent
'playlistRemoved' correctly return Playlist object

drakinite

2022-05-25 16:29

developer   ~0068243

Updated JSdoc for playlistRemoved to reflect the new behavior.