Hi,
I'd like to check the playlists in which a specific title is in. How do I get this information without browsing each playlist ?
thanks
christian
Can I see all playlists for a specific title ?
Moderator: Gurus
-
- Posts: 2153
- Joined: Fri Jan 14, 2005 1:45 am
- Location: Germany
- Contact:
I made a script a time ago where you can delete a selected title from a playlist (it shows all playlists where the title is in)
Select a file (via TrayIcon or in NowPlaying-Window) -> Right Mouse Button -> Remove from ...
maybe it helps you
Select a file (via TrayIcon or in NowPlaying-Window) -> Right Mouse Button -> Remove from ...
maybe it helps you
Code: Select all
New Code below ...
Last edited by onkel_enno on Tue Jan 10, 2006 6:49 am, edited 5 times in total.
Hi onkle_enno,
sorry for criticizing you, but I guess you made some copy-paste-errors:
Line 53: must be "mnu" instead of "dic"
Line 59: must be "mnu" instead of "dic"
I'm not sure whether I had to do one more of the above replacements before it worked ...
Without these corrections, the tray menu entry causes a runtime error.
sorry for criticizing you, but I guess you made some copy-paste-errors:
Line 53: must be "mnu" instead of "dic"
Line 59: must be "mnu" instead of "dic"
I'm not sure whether I had to do one more of the above replacements before it worked ...
Without these corrections, the tray menu entry causes a runtime error.
-
- Posts: 2153
- Joined: Fri Jan 14, 2005 1:45 am
- Location: Germany
- Contact:
@rk
Thanks for the hint, you're right. I'll change it a little.
Nevertheless it should work too (and it does for me and MmChris) because at that point there will never be an object with that name - it'll always have to be created. But ok, a bug is a bug
Could you please try it again and give me an information via PM? Thx
BTW it was a long, long time ago when I created that Script
Thanks for the hint, you're right. I'll change it a little.
Nevertheless it should work too (and it does for me and MmChris) because at that point there will never be an object with that name - it'll always have to be created. But ok, a bug is a bug
Could you please try it again and give me an information via PM? Thx
BTW it was a long, long time ago when I created that Script
-
- Posts: 2153
- Joined: Fri Jan 14, 2005 1:45 am
- Location: Germany
- Contact:
New Version of my RemoveFromPlayList-Script
Code: Select all
option explicit
'#################################################
' Language Constants
'#################################################
const strRemoveFrom = "Entfernen aus ..."
const strConfirmation = "Wirklich alle %1 Titel aus Playliste '%2' löschen?" '%1=Number of Files, %2 = Playlist-Name
'#################################################
' Object-Names (for future use)
'#################################################
const strObjNP = "RemoveFromPlaylistNP" 'unique Object Name of SubMenu and Dictionary in Now Playing-Menu
const strObjTray = "RemoveFromPlaylistTray" 'unique Object Name of SubMenu and Dictionary in TrayIcon-SubMenu
const strObjMain = "RemoveFromPlaylistMain" 'unique Object Name of SubMenu and Dictionary in MainMenuIcon-SubMenu
'#################################################
' Start-Up Function (Create Main-Menu)
'#################################################
Sub OnStartUp
dim MenuItem
'Adds Menu to Now Playing
set MenuItem = SDB.Objects("mnu" & strObjNP)
if MenuItem is nothing then
set MenuItem = SDB.UI.AddMenuItemSub(SDB.UI.Menu_Pop_NP, 3, 2)
MenuItem.IconIndex = 56
MenuItem.Caption =strRemoveFrom 'SDB.Localize("Remove") & " ..."
MenuItem.Hint = Mid("mnu" & strObjNP, 4)
MenuItem.Enabled = True
MenuItem.UseScript = Script.ScriptPath
MenuItem.OnClickFunc = "AddPlaylists"
SDB.Objects("mnu" & strObjNP) = MenuItem
end if
Set MenuItem = Nothing
'Adds Menu to Tray Icon
set MenuItem = SDB.Objects("mnu" & strObjTray)
if MenuItem is nothing then
SDB.UI.AddMenuItemSep SDB.UI.Menu_TrayIcon, -2, -1
set MenuItem = SDB.UI.AddMenuItemSub(SDB.UI.Menu_TrayIcon, -2, -1) 'vorletzte Sektion, letzter Eintrag
MenuItem.IconIndex = 56
MenuItem.Caption = strRemoveFrom 'SDB.Localize("Remove") & " ..."
MenuItem.Hint = Mid("dic" & strObjTray, 4)
MenuItem.Enabled = True
MenuItem.UseScript = Script.ScriptPath
MenuItem.OnClickFunc = "AddPlaylists"
SDB.Objects("mnu" & strObjTray) = MenuItem
end if
Set MenuItem = Nothing
'Adds Menu to Main Track Window
set MenuItem = SDB.Objects("mnu" & strObjMain)
if MenuItem is nothing then
SDB.UI.AddMenuItemSep SDB.UI.Menu_Pop_TrackList, -2, -1
set MenuItem = SDB.UI.AddMenuItemSub(SDB.UI.Menu_Pop_TrackList, -2, -1) 'vorletzte Sektion, letzter Eintrag
MenuItem.IconIndex = 56
MenuItem.Caption = strRemoveFrom 'SDB.Localize("Remove") & " ..."
MenuItem.Hint = Mid("dic" & strObjMain, 4)
MenuItem.Enabled = True
MenuItem.UseScript = Script.ScriptPath
MenuItem.OnClickFunc = "AddPlaylists"
SDB.Objects("mnu" & strObjTray) = MenuItem
end if
Set MenuItem = Nothing
end Sub
'#################################################
' Add Sub-Menus (Playlists)
'#################################################
Sub AddPlaylists(Item)
dim SubMenuItem
dim dsPlaylist
Dim Song
Dim SongIDs()
dim itm
dim PlaylistID
dim PlaylistName
dim Terms
Dim TermsSep
dim strObjMenu
strObjMenu = "mnu" & Item.Hint
dim strObjDictMenu
strObjDictMenu = "dic" & Item.Hint
'Dictionary for Playlisten-IDs
'-> to know which Menu-Entries are already created
dim DictRemoveFromPlaylist
set DictRemoveFromPlaylist = SDB.Objects(strObjDictMenu)
if DictRemoveFromPlaylist is nothing then
Set DictRemoveFromPlaylist = CreateObject("Scripting.Dictionary")
SDB.Objects(strObjDictMenu) = DictRemoveFromPlaylist
end if
'Disable all Playlists
Dim ObjectNames
ObjectNames = DictRemoveFromPlaylist.Items
for itm = 0 to DictRemoveFromPlaylist.Count - 1
SDB.Objects(ObjectNames(itm)).Enabled = False
next
if strObjMenu = "mnu" & strObjNP then
Redim SongIDs(SDB.SelectedSongList.Count)
for itm=0 to SDB.SelectedSongList.Count-1
SongIDs(itm+1) = SDB.SelectedSongList.Item(itm).ID
next
elseif strObjMenu = "mnu" & strObjTray then
Redim SongIDs(1)
SongIDs(1) = SDB.Player.CurrentSong.ID
elseif strObjMenu = "mnu" & strObjMain then
Redim SongIDs(1)
Redim SongIDs(SDB.SelectedSongList.Count)
for itm=0 to SDB.SelectedSongList.Count-1
SongIDs(itm+1) = SDB.SelectedSongList.Item(itm).ID
next
end if
If Ubound(SongIDs)>0 then
for itm=1 to Ubound(SongIDs)
Song = SongIDs(itm)
if terms = "" then
terms = Song
else
terms = terms & " OR IDSong = " & Song
end if
TermsSep = "|" & Song & TermsSep
next
TermsSep = Mid(TermsSep, 2)
'only Playlists that include these Songs
set dsPlaylist = SDB.Database.OpenSQL("SELECT Playlists.IDPlaylist, Playlists.PlaylistName, x.IDPlaylist as vorhanden FROM Playlists INNER JOIN (SELECT PlaylistSongs.IDPlaylist FROM PlaylistSongs WHERE PlaylistSongs.IDSong=" & terms & " GROUP BY PlaylistSongs.IDPlaylist) as X ON x.IDPlaylist=Playlists.IDPlaylist where Playlists.IsAutoPlaylist is null GROUP BY Playlists.IDPlaylist, Playlists.PlaylistName, x.IDPlaylist")
'all Playlists
'set dsPlaylist = SDB.Database.OpenSQL("SELECT Playlists.IDPlaylist, Playlists.PlaylistName, x.IDPlaylist as vorhanden FROM Playlists INNER JOIN (SELECT PlaylistSongs.IDPlaylist FROM PlaylistSongs WHERE PlaylistSongs.IDSong=" & terms & " GROUP BY PlaylistSongs.IDPlaylist) as X ON x.IDPlaylist=Playlists.IDPlaylist where Playlists.IsAutoPlaylist is null GROUP BY Playlists.IDPlaylist, Playlists.PlaylistName, x.IDPlaylist")
while not dsPlaylist.EoF
PlaylistID = dsPlaylist.StringByIndex(0)
PlaylistName = dsPlaylist.StringByIndex(1)
If DictRemoveFromPlaylist.Exists(PlaylistID) then
set SubMenuItem = SDB.Objects(strObjMenu & PlaylistID)
else
set SubMenuItem=SDB.UI.AddMenuItem(Item, 1, 1 )
SubMenuItem.Caption = PlaylistName
SubMenuItem.IconIndex = 17
SubMenuItem.useScript = Script.ScriptPath
DictRemoveFromPlaylist.Add PlaylistID, strObjMenu & PlaylistID
SDB.Objects(strObjMenu & PlaylistID) = SubMenuItem
end if
if dsPlaylist.StringByIndex(2)="" then
'Playlist doesn't include the Title
SubMenuItem.Enabled=False
else
SubMenuItem.Hint = PlaylistID & "|" & Ubound(SongIDs) & "|" & TermsSep 'Playliste, Anzahl Songs, Songs
SubMenuItem.OnClickFunc = "DeleteFromPlaylist"
SubMenuItem.Enabled=True
end if
dsPlaylist.next
wend
Set dsPlaylist = Nothing
End If
Set DictRemoveFromPlaylist = Nothing
end Sub
'#################################################
' Delete selected Tracks from Playlist
'#################################################
Sub DeleteFromPlaylist(Item)
Dim Params
dim Tracklist
dim Song
dim SongItem
dim terms
dim ReallyDo
Params = Split(Item.Hint, "|")
if Params(1)>0 then
if Params(1)>1 then
ReallyDo = (SDB.MessageBox(Replace(Replace(strConfirmation, "%2", Item.Caption), "%1", Params(1)), mtConfirmation, Array(mbYes, mbNo)) = mrYes)
else
ReallyDo = True
end if
if ReallyDo then
for SongItem=2 to Ubound(Params)
'Skip if currently playing
if SDB.Player.CurrentSong.ID = Int(Params(SongItem)) then SDB.Player.Next
'Remove from Now Playing
DeleteFromNowPlaying Params(SongItem) 'Song.ID =! Index in Playlist
if terms = "" then
terms = Params(SongItem)
else
terms = terms & " OR IDSong = " & Params(SongItem)
end if
next
'Remove from Playlist
SDB.DataBase.ExecSQL("Delete from PlaylistSongs WHERE IDPlaylist=" & Params(0) & " and (IDSong = " & terms & ")")
SDB.MainTracksWindow.Refresh
end if
end if
end Sub
'#################################################
' Delete Track from Now Playing
'#################################################
Sub DeleteFromNowPlaying(IDSong)
dim Tracklist
dim SongItem
IDSong=Int(IDSong)
Set Tracklist = SDB.Player.CurrentSongList
if Tracklist.Count>0 then
for SongItem=Tracklist.Count-1 to 0 Step -1 'Count down
if Tracklist.Item(SongItem).ID = IDSong then
SDB.Player.PlaylistDelete(SongItem)
end if
next
end if
end Sub
Re: Can I see all playlists for a specific title ?
I'm resurrecting this thread from the dead, because I just recently upgraded to MediaMonkey Version 3. This script worked beautifully for me on Version 2, but when I attempt to use it on Version 3 it crashes MediaMonkey. I'd love to still have the functionality of this script, which allows me to see what playlists a file may be part of, and to remove the file from that playlist if I choose.
Perhaps there's another way to do that with Version 3, and if so, I'd love any guidance anyone could give about setting it up. Otherwise, if someone could explain what I need to change on this script to keep it from crashing Version 3, I'd appreciate it.
Thank you!
Perhaps there's another way to do that with Version 3, and if so, I'd love any guidance anyone could give about setting it up. Otherwise, if someone could explain what I need to change on this script to keep it from crashing Version 3, I'd appreciate it.
Thank you!
Re: Can I see all playlists for a specific title ?
Check the Classification tab of the Track Properties. It lists the playlists the particular track belongs to.
Download MediaMonkey | License
Help: Knowledge Base | MediaMonkey for Windows 5 | MediaMonkey for Android
Lowlander (MediaMonkey user since 2003)
Help: Knowledge Base | MediaMonkey for Windows 5 | MediaMonkey for Android
Lowlander (MediaMonkey user since 2003)
Re: Can I see all playlists for a specific title ?
I didn't realize that existed! Thank you.