by eepman » Fri Feb 10, 2012 2:48 pm
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
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]
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
[/code]