Script to prevent MM to add a song twice (by it's name)

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

Moderator: Gurus

Script to prevent MM to add a song twice (by it's name)

Postby Mike24 » Tue Jan 10, 2017 3:46 pm

How to keep MM from adding a song in a playlist twice - by it's title not by it's id?

I already wrote some scripts on reading playlists, doing avanced reporting and so. But now I want to do something more advance. I know there is already a function included in MM which prevents adding a song twice in a playlist. But this is based on the id of a song not by it's title.

So if I have a playlist which already contains e.g. Nothing Compares 2 U by Prince I wan't to forbid adding Nothing Compares 2 U by Sinead O’Connor.

How can I catch the event when a song (or a list of songs) is added by drag and drop to a playlist so that I can check wheather it's name is already in the list an cancel the drop?

Any hints welcome

Mike
Mike24
 
Posts: 1
Joined: Tue Jan 10, 2017 3:36 pm

Re: Script to prevent MM to add a song twice (by it's name)

Postby rivorson » Tue Jan 10, 2017 5:11 pm

You can capture the OnPlaylistChanged event.
http://www.mediamonkey.com/wiki/index.p ... istChanged

The event will pass a playlist object as its parameter but as far as I can tell there's no way to see which track was added. You could then check the entire playlist for duplicate titles.
rivorson
 
Posts: 526
Joined: Thu Jul 25, 2013 4:17 am


Return to MediaMonkey 4 Addons developer forum

Who is online

Users browsing this forum: No registered users and 3 guests