SDBPlaylist.RemoveTrack DOES NOT WORK PROPERLY 4.0

Beta Testing for Windows Products and plugins

Moderator: Gurus

eepman
Posts: 45
Joined: Sun Aug 02, 2009 2:45 pm
Location: basement
Contact:

SDBPlaylist.RemoveTrack DOES NOT WORK PROPERLY 4.0

Post by eepman »

I've been using this method and RemoveTrackNoConfirmation as outlined on the wiki (http://www.mediamonkey.com/wiki/index.php/SDBPlaylist) to remove tracks from a playlist but it continues to remove the tracks from the main tracks window playlist that is active rather than the playlist it is called on.

For instance, in the code below the msgbox echoes the playlist i want to remove the track from and then when i refresh the track is gone from the playlist selected in the main tree rather than the playlist echoed.

Code: Select all

Sub RemoveFromPlaylist(PlaylistID)
	Set Playlist = SDB.PlaylistByID(CLng(PlaylistID))
	If Playlist Is Nothing Then
		MsgBox "Invalid Playlist"
		Exit Sub
	End If
	
	If DEBUG Then
		MsgBox "Removed from Playlist: " & Playlist.Title
	End If

	Select Case ini.IntValue("PlaylistPanel","TrackMode") 
		Case SELECTED_TRACK_MODE
			If SDB.SelectedSongList.Count = 0 Then
				MsgBox "No Songs Selected"
				Exit Sub
			Else
				for i = 0 to SDB.SelectedSongList.Count - 1
					Playlist.RemoveTrackNoConfirmation SDB.SelectedSongList.Item(i)
				next
			End If

		Case NP_TRACK_MODE
			Playlist.RemoveTrackNoConfirmation SDB.Player.CurrentSong

		Case MIXED_MODE
			If SDB.Player.IsPaused Or SDB.Player.IsPlaying Then
				Playlist.RemoveTrackNoConfirmation SDB.Player.CurrentSong
			Else
				If SDB.SelectedSongList.Count = 0 Then
					Exit Sub
				Else
					for i = 0 to SDB.SelectedSongList.Count - 1
						Playlist.RemoveTrackNoConfirmation SDB.SelectedSongList.Item(i)
					next
				End If
			End If
	End Select 

	Set Playlist = Nothing
End Sub
Last edited by Lowlander on Fri Feb 10, 2012 3:11 pm, edited 1 time in total.
Reason: Merged with existing topic
radium.io -- build software fearlessly