How to create AutoPlaylist via script?

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

Moderators: jiri, drakinite, Addon Administrators

MisterFlix
Posts: 12
Joined: Sun Mar 06, 2016 5:43 am

How to create AutoPlaylist via script?

Post by MisterFlix »

In my media manager, I like to have playlists of "Toprated + <each Genre>" and "Unrated + <each Genre>."
Of course, creating those playlists by hand is rather cumbersome, so when I found out that MM5 scripting is done via Javascript, a language I'm already fairly comfortable with, I got to work immediately.

So far, I have a script that can tell me which Playlists I still need to create, and which are superfluous. However, the creatio (and deletion) process is still manual, hence my question (as I can't seem to manage to grasp it from the API Doc and Database):

How do I create an AutoPlaylist?
How do I delete a Playlist?

If creating an AutoPlaylist isn't possible [at this point (?)]:
How do I create a normal Playlist, and add/remove songs from it?
Overall, this option can also work, though it would of course mean that I'd have to run the script after any change in rating again...


Thank you very much!
Kind Regards,
Flix
Peke
Posts: 17567
Joined: Tue Jun 10, 2003 7:21 pm
Location: Earth
Contact:

Re: How to create AutoPlaylist via script?

Post by Peke »

Hi,
There is no way to create Auto-Playlist Using Scripts you can only create Static playlist as a child playlist.
Best regards,
Peke
MediaMonkey Team lead QA/Tech Support guru
Admin of Free MediaMonkey addon Site HappyMonkeying
Image
Image
Image
How to attach PICTURE/SCREENSHOTS to forum posts
Ludek
Posts: 4983
Joined: Fri Mar 09, 2007 9:00 am

Re: How to create AutoPlaylist via script?

Post by Ludek »

How do I create an AutoPlaylist?
See actions.newAutoPlaylist in actions.js

Basically this is how to create auto-playlist:

Code: Select all

var newplaylist = app.playlists.root.newPlaylist();
newplaylist.name = 'New Auto-Playlist';
newplaylist.isAutoPlaylist = true;
newplaylist.commitAsync();
How do I delete a Playlist?
Just call deleteAsync() method on the playlist object.
mdovey
Posts: 5
Joined: Thu Jul 13, 2023 4:06 am

Re: How to create AutoPlaylist via script?

Post by mdovey »

Apologies for resurrecting an old thread, but I found this when researching for a similar need.

Ludek's response covers creating the autoplaylist, however, I can't see in the API documentation anyway of creating/modifying the autoplaylist criteria from a script. Is this not possible?

Matthew
Post Reply