change (add) the tray MM icon options?
change (add) the tray MM icon options?
I would like to know if there´s any script that allows to choose what options you get when you hit the MM tray icon. I would love to get an Edit Mood option there.
I searched the forum with no luck. Any of you know a way to get this done?
Thanks in advance
I searched the forum with no luck. Any of you know a way to get this done?
Thanks in advance
It depends on what you want exactly, but new items can be added to the tray menu in the same way as this happens for normal menus in MediaMonkey.
So adding a new item is no problem. The thing is, what do you want to happen if the item is clicked? Or is it a menu item with subitems?
Cheers
Steegy
So adding a new item is no problem. The thing is, what do you want to happen if the item is clicked? Or is it a menu item with subitems?
Cheers
Steegy
Extensions: ExternalTools, ExtractFields, SongPreviewer, LinkedTracks, CleanImport, and some other scripts (Need Help with Addons > List of All Scripts).
I think the request is for a "My Moods" submenu that works in the same way as the "My Rating" one, when you right click on the tray icon.
Download my scripts at my own MediaMonkey fansite.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.
Because the Mood icon is unavailable for menus, an other one is used. If necessary, the right icon can be included as separate file.
I used "Mood" instead of "My Moods..." text, because the first one is localisable, the second is not. Of course you can change this text to what you want.
This script requires MM 2.5.3 or newer, because that version includes the new LocalizeGen method and because a bug (that caused changing the mood through scripting didn't have any effect) has been fixed.
Cheers
Steegy
I used "Mood" instead of "My Moods..." text, because the first one is localisable, the second is not. Of course you can change this text to what you want.
This script requires MM 2.5.3 or newer, because that version includes the new LocalizeGen method and because a bug (that caused changing the mood through scripting didn't have any effect) has been fixed.
Code: Select all
Option Explicit
Sub OnStartup
Dim MI
Set MI = SDB.UI.AddMenuItemSub(SDB.UI.Menu_TrayIcon, 1, 2)
MI.Caption = SDB.Localize("Mood")
MI.IconIndex = 31
Script.RegisterEvent MI, "OnClick", "MIClick"
End Sub
Sub MIClick(MI)
' Fill the tray moods list
' and check the mood for the currently playing song
Dim Iter, MSI
Set Iter = SDB.Database.OpenSQL("SELECT TextData FROM Lists WHERE IDListType=2 ORDER BY SortOrder")
Dim LocalisedMood
Do While Not Iter.EOF
LocalisedMood = SDB.LocalizeGen("DB", Iter.StringByIndex(0))
If SDB.Objects("TrayMoods_" & LocalisedMood) Is Nothing Then
Set MSI = SDB.UI.AddMenuItem(MI, 0, 0)
MSI.Caption = LocalisedMood
MSI.IconIndex = 31
Script.RegisterEvent MSI, "OnClick", "MSIClick"
Set SDB.Objects("TrayMoods_" & LocalisedMood) = MSI
End If
SDB.Objects("TrayMoods_" & LocalisedMood).Checked = False
Iter.Next
Loop
Dim CurrentSong : Set CurrentSong = SDB.Player.CurrentSong
If Not CurrentSong Is Nothing Then
If CurrentSong.Mood <> "" Then
If Not SDB.Objects("TrayMoods_" & CurrentSong.Mood) Is Nothing Then
SDB.Objects("TrayMoods_" & CurrentSong.Mood).Checked = True
End If
End If
End If
End Sub
Sub MSIClick(MSI)
' Store the chosen mood to the song's properties
Dim CurrentSong : Set CurrentSong = SDB.Player.CurrentSong
If Not CurrentSong Is Nothing Then
CurrentSong.Mood = MSI.Caption
Dim SongList : Set SongList = SDB.NewSongList
Call SongList.Add(CurrentSong)
Call SongList.UpdateAll
End If
End Sub
Steegy
Last edited by Steegy on Sat May 27, 2006 8:22 am, edited 5 times in total.
Extensions: ExternalTools, ExtractFields, SongPreviewer, LinkedTracks, CleanImport, and some other scripts (Need Help with Addons > List of All Scripts).
-
- Posts: 2153
- Joined: Fri Jan 14, 2005 1:45 am
- Location: Germany
- Contact:
Have a look here. It workes that way.Steegy wrote:I don't know if this is already possible, but in the future it might be possible to fill the tray-sublist each time it is opened, so it is always correct.
Is the OnClick event raised even if the parent menu is not clicked, but just hovered (mouse-over)?
BTW: I was just trying out your script, when I saw this other post (multi-artist thread).
EDIT: Never mind the above question... aparently it works.
EDIT2: The above code has been changed so it now checks the current mood in the submenu, and it loads the moods list when the menu is opened, so it's always actual.
EDIT3: An improvement would be to drop the dictionary usage, but that's for a next version.
BTW: I was just trying out your script, when I saw this other post (multi-artist thread).
EDIT: Never mind the above question... aparently it works.
EDIT2: The above code has been changed so it now checks the current mood in the submenu, and it loads the moods list when the menu is opened, so it's always actual.
EDIT3: An improvement would be to drop the dictionary usage, but that's for a next version.
Extensions: ExternalTools, ExtractFields, SongPreviewer, LinkedTracks, CleanImport, and some other scripts (Need Help with Addons > List of All Scripts).
Well, I have posted about this problem in the debug forum, but I've got no responce yet. Maybe bumping that thread will make that someone responds...
Extensions: ExternalTools, ExtractFields, SongPreviewer, LinkedTracks, CleanImport, and some other scripts (Need Help with Addons > List of All Scripts).
-
- Posts: 2153
- Joined: Fri Jan 14, 2005 1:45 am
- Location: Germany
- Contact:
-
- Posts: 1017
- Joined: Wed Mar 01, 2006 1:09 am
- Location: In a jungle down under
- Contact:
I possibly will make a fool out of myself here
I just found that MM database do not feature any Mood/Tempo storage.
I DID MAKE A FOOL OF MYSELF!
Message edited to save space....
I just found that MM database do not feature any Mood/Tempo storage.
I DID MAKE A FOOL OF MYSELF!
Message edited to save space....
Last edited by DiddeLeeDoo on Tue Apr 25, 2006 5:18 am, edited 1 time in total.
Mood, Tempo, ... *are* stored in the DB.
The list table gives, as you said, a list of all possible entries (and each entry has an ID)
In the AddSongInfoInt table, the actual references to the List table are stored for each song in the database (that has a mood, tempo, ... defined). The IntData column is linked to List.ID.
So to find the a certain characteristic of a song, you look in the Songs table to get it's ID. With that ID, you search the matching IDSong in the AddSongInfoInt table. You will then possibly see different entries for the same song, with different IntData fields. Each IntData field represents a certain characteristic that is linked to the ID of the List table.
E.g., if you want to find all songs matching a certain characteristic (from the PlayHotkeys_v1.0.vbs/Utility_SQL.vbs script)maybe code can be made "easier" like "SELECT blablabla FROM foo, bar, baz ...", but the above way seems to be the preferred sql way.
See the "scripting resources" (link in my signature) to find a text file with the database locations for (almost) all available track properties.
Cheers
Steegy
The list table gives, as you said, a list of all possible entries (and each entry has an ID)
In the AddSongInfoInt table, the actual references to the List table are stored for each song in the database (that has a mood, tempo, ... defined). The IntData column is linked to List.ID.
So to find the a certain characteristic of a song, you look in the Songs table to get it's ID. With that ID, you search the matching IDSong in the AddSongInfoInt table. You will then possibly see different entries for the same song, with different IntData fields. Each IntData field represents a certain characteristic that is linked to the ID of the List table.
E.g., if you want to find all songs matching a certain characteristic (from the PlayHotkeys_v1.0.vbs/Utility_SQL.vbs script)
Code: Select all
' Returns a SDBSongIterator object (EOF/Item/Next) for all songs with the specified InfoIntValue
Public Function SQLGetSongsInfoInt(InfoIntValue)
Set SQLGetSongsInfoInt = SDB.Database.QuerySongs("AND Songs.ID IN (SELECT Songs.ID FROM ((Lists INNER JOIN AddSongInfoInt ON Lists.ID = AddSongInfoInt.IntData) INNER JOIN Songs ON AddSongInfoInt.IDSong = Songs.ID) INNER JOIN Artists ON Songs.IdArtist = Artists.ID WHERE Lists.TextData = '" & InfoIntValue & "')")
End Function
See the "scripting resources" (link in my signature) to find a text file with the database locations for (almost) all available track properties.
Cheers
Steegy
Extensions: ExternalTools, ExtractFields, SongPreviewer, LinkedTracks, CleanImport, and some other scripts (Need Help with Addons > List of All Scripts).
-
- Posts: 1017
- Joined: Wed Mar 01, 2006 1:09 am
- Location: In a jungle down under
- Contact:
Thank you, sitting here to try to catch up with you here, as I'd like to help if I can.
Potential solution:
to keep to the standard translated moods. But that may be a silly solution.
Another thing, I believe there should be a Localize in the loop in order to look-up the translated value for mood 'Upbeat' for example.
Then something about, if translated value do not exist, use value in Lists.
This bit seems to be missing an object if song already have a different value.
If SDB.Player.CurrentSong.Mood <> "" Then
SDB.Objects("TrayMoods_" & SDB.Player.CurrentSong.Mood).Checked = True
End If
I've been sitting here trying to catch up with you folks on this issue, but I see this is for experts really. Sorry to stuff up your thread.
Potential solution:
Code: Select all
SELECT TextData FROM Lists WHERE ID < 39 AND IDListType=2 ORDER BY SortOrder
Another thing, I believe there should be a Localize in the loop in order to look-up the translated value for mood 'Upbeat' for example.
Then something about, if translated value do not exist, use value in Lists.
This bit seems to be missing an object if song already have a different value.
If SDB.Player.CurrentSong.Mood <> "" Then
SDB.Objects("TrayMoods_" & SDB.Player.CurrentSong.Mood).Checked = True
End If
I've been sitting here trying to catch up with you folks on this issue, but I see this is for experts really. Sorry to stuff up your thread.
Thanks.
Once that version comes out, I'll change the lineto(updated according to jiri's post)
In the updated code above, I fixed the "no currentsong error" problem, and got rid of the dictionary.
@DiddeLeeDoo, "for your information":
- I want the mood tray menu to look exactly the same as the mood toolbar menu, so this new LocalizeGen seems the only solution to the problem. I want to include all available moods.
- SDB.Localize("TextToLocalize") returns the translated text of TextToLocalize. If there is no translation available, it automaticly returns the specified text TextToLocalize.
Thanks for the help.
Once that version comes out, I'll change the line
Code: Select all
LocalisedMood = SDB.Localize(Iter.StringByIndex(0))
Code: Select all
LocalisedMood = SDB.LocalizeGen( "DB", Iter.StringByIndex(0))
In the updated code above, I fixed the "no currentsong error" problem, and got rid of the dictionary.
@DiddeLeeDoo, "for your information":
- I want the mood tray menu to look exactly the same as the mood toolbar menu, so this new LocalizeGen seems the only solution to the problem. I want to include all available moods.
- SDB.Localize("TextToLocalize") returns the translated text of TextToLocalize. If there is no translation available, it automaticly returns the specified text TextToLocalize.
Thanks for the help.
Last edited by Steegy on Tue Apr 25, 2006 1:46 pm, edited 2 times in total.
Extensions: ExternalTools, ExtractFields, SongPreviewer, LinkedTracks, CleanImport, and some other scripts (Need Help with Addons > List of All Scripts).
Just to help you in faster code update, it will be:
Jiri
Code: Select all
LocalisedMood = SDB.LocalizeGen( "DB", Iter.StringByIndex(0))