Is there a simple scripting method to test if a song is already in a playlist?
I'd like to avoid the MM duplication confirmation page I would get otherwise. Obviously one could go through a loop of each song in playlist, but I'm wondering if it isn't easier than that.
Clever method to check if song in playlist?
Moderators: Gurus, Addon Administrators
-
- Posts: 64
- Joined: Mon Sep 03, 2012 12:06 pm
Re: Clever method to check if song in playlist?
The following Addon can show this in a panel: http://www.mediamonkey.com/forum/viewto ... tion+panel
The Classification tab of the Properties window will also show what Playlist(s) a file belongs to.
The Classification tab of the Properties window will also show what Playlist(s) a file belongs to.
Download MediaMonkey ♪ License ♪ Knowledge Base ♪ MediaMonkey for Windows 2024 Help ♪ MediaMonkey for Android Help
Lowlander (MediaMonkey user since 2003)
Lowlander (MediaMonkey user since 2003)
-
- Posts: 64
- Joined: Mon Sep 03, 2012 12:06 pm
Re: Clever method to check if song in playlist?
No, I mean in order to accomplish an IF/THEN like below:
If Not In Playlist "whatever"( theSong) then
SDB.PlaylistByTitle("whatever").AddTrack( theSong )
end if
I can tighten the goal down to 5 lines of code, but wonder if I haven't missed some single line that does the job:
Dup = False
for i = 0 To SDB.PlaylistByTitle(Playlist).Tracks.Count - 1
if SDB.PlaylistByTitle(Playlist).Tracks.Item(i).ID = NewSong.ID Then Dup = True
next
if Dup = False Then SDB.PlaylistByTitle(Playlist).AddTrack NewSong
If Not In Playlist "whatever"( theSong) then
SDB.PlaylistByTitle("whatever").AddTrack( theSong )
end if
I can tighten the goal down to 5 lines of code, but wonder if I haven't missed some single line that does the job:
Dup = False
for i = 0 To SDB.PlaylistByTitle(Playlist).Tracks.Count - 1
if SDB.PlaylistByTitle(Playlist).Tracks.Item(i).ID = NewSong.ID Then Dup = True
next
if Dup = False Then SDB.PlaylistByTitle(Playlist).AddTrack NewSong
Re: Clever method to check if song in playlist?
You could accelerate that by exiting the loop in the THEN.Just Guessing wrote: I can tighten the goal down to 5 lines of code, but wonder if I haven't missed some single line that does the job:
Dup = False
for i = 0 To SDB.PlaylistByTitle(Playlist).Tracks.Count - 1
if SDB.PlaylistByTitle(Playlist).Tracks.Item(i).ID = NewSong.ID Then Dup = True
next
if Dup = False Then SDB.PlaylistByTitle(Playlist).AddTrack NewSong
Chris
Re: Clever method to check if song in playlist?
Don't you get this option to avoid that confirmation dialog?Just Guessing wrote:Is there a simple scripting method to test if a song is already in a playlist?
I'd like to avoid the MM duplication confirmation page I would get otherwise.

Chris