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 for Windows 4.

Moderators: Gurus, Addon Administrators

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

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

Post by Mike24 »

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
rivorson
Posts: 594
Joined: Thu Jul 25, 2013 4:17 am

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

Post by rivorson »

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.
Post Reply