Posted: Wed Apr 19, 2006 1:47 pm
Great moded script.
Thank you !
Thank you !
The Music Manager for Serious Collectors
http://www.mediamonkey.com/forum/
baker wrote:This is a great script. I've been using it to update not only genres but year and custom fields and. There's only one problem though.. Is there anyway to tell MM not to use these hotkeys when modifying a filename? For example, if I want to change a filename to "Beatles - Sgt Pepper", I can't do it unless I go into Properties because I have the 'B' key assigned to 'Blues'. Mucho gracias.
Code: Select all
'==========================================================================
'
' MediaMonkey Script
'
' NAME: Predefined RATING Script v1.4
' DATE: 14.07.2007
'
' ADDITIONAL AUTHOR: Negative Zero
' DATE: 22.01.2006
'
' AUTHOR: LIMEX
' DATE: 22.01.2006
'
' ORIGINAL AUTHOR: Ralf K.
'DATE: 26.08.2005
'
' NOTE: Idea taken from Pekes "Predefined Genre Script v1.0".
' LIMEX: I changed to use buttons 1-0 instead of 1-5 in order to assign also 1/2 stars.
'
' INSTALLATION:
' - Feel free to change the constants at the beginning of this file
' - Copy script to MM directory scripts\auto
'
' USE:
' - Press key "`",1-0,"-" to rate the currently selected song(s)
' - If no song is selected then currently playing song is rated
'
' REMARK: Rating process now can be done very fast without additional mouse clicks:
' 1) Start playing a list
' 2) Make sure no tracks are selected (otherwise they catch the rating)
' 3) Listen to track; wind forward if needed with '3' on numeric pad
' 4) Press "`",1-0,"-" on normal keyboard for rating
' 5) Jump to next song with '9' an numeric pad
' 6) Continue with step 3)
'
'==========================================================================
'==========================================================================
' Define some constants
'==========================================================================
'Set Value to TRUE/FALSE if you want to use HotKey modifiers
const Use_Shift = FALSE 'TRUE
const Use_Ctrl = FALSE 'TRUE
const Use_Alt = FALSE 'TRUE
'Icon to be used in the menu
const MenuIcon = 64 '=yellow star
'==========================================================================
' MediaMonkey on-start Procedure
'==========================================================================
Sub OnStartup
' --------------
' Build the hotkey modifier
' --------------
Dim HotKeyRing
HotKeyRing = ""
If Use_Shift Then HotKeyRing = HotKeyRing&"Shift+"
If Use_Ctrl Then HotKeyRing = HotKeyRing&"Ctrl+"
If Use_Alt Then HotKeyRing = HotKeyRing&"Alt+"
' ----------------
' Create a new edit menu entry
' ----------------
' first we make a separator
SDB.UI.AddMenuItemSep SDB.UI.Menu_Edit, 0, 0
' then we add the new menu
Dim RatingMenu
Set RatingMenu = SDB.UI.addMenuItemSub(SDB.UI.Menu_Edit,0,0)
With RatingMenu
.caption = "Change Rating"
.IconIndex = MenuIcon
.useScript = Script.ScriptPath
End With
' ----------------
' Create the sub menus
' ----------------
Dim RatingSubmenu(12), i, count, caption, key, icon
count = -1
For i = 0 To 11
key = i
caption = count&".5" ' will be overwritten on first pass by second if statement below
If i Mod 2 = 0 Then ' satisfied only on even numbered loop iterations
count = count+1
caption = count&".0"
End If
caption = caption&" Stars"
If i = 0 Then
key = "`"
caption = "0 Stars"
ElseIf i = 10 Then
key = 0
ElseIf i = 11 Then
key = "-"
caption = "Unknown Rating"
End If
If i = 2 Then caption = Left(caption,Len(caption)-1)
icon = "Y"
If i = 0 Then icon = "N"
If i = 11 Then icon = "N"
Set RatingSubmenu(i) = SDB.UI.AddMenuItem(RatingMenu,0,0)
With RatingSubmenu(i)
.Caption = caption
.OnClickFunc = "PredefinedRating"
.UseScript = Script.ScriptPath
.ShortCut = HotKeyRing&key
If icon = "Y" Then .IconIndex = MenuIcon
End With
Next
End Sub
'==========================================================================
' Helper and callback procedure
'==========================================================================
Sub EditRating(i_rating)
Dim songlist, song, i
' ---------------
' First check which songs to alter
' ---------------
If SDB.SelectedSongList.count > 0 Then
Set songlist = SDB.SelectedSongList
ElseIf SDB.Player.CurrentSongIndex >= 0 then
Set songlist = SDB.NewSongList
songlist.Add(SDB.Player.CurrentSong)
Else
Result = SDB.MessageBox("No tracks selected!", mtError, Array(mbOk))
Exit Sub
End If
' ---------------
' Change the songs rating
' ---------------
For i = 0 To songlist.count-1
Set song = songlist.Item(i)
With song
.Rating = i_rating
.UpdateDB 'update MM database
.WriteTags 'write data to file tag
End With
Next
' free memory again??
' songlist = nothing
End Sub
Sub PredefinedRating(i_menuItem)
' Rating varies from 0 (= 0 stars) to 100 (= 5 stars)
' So we multiply caption (= 1...0) with 10
Dim i_rating
i_rating = Right(i_menuItem.ShortCut,1)
If i_rating = "`" Then
i_rating = 0
ElseIf i_rating = "-" Then
i_rating = -1
ElseIf i_rating = 0 Then
i_rating = 100
Else
i_rating = i_rating*10
End If
EditRating(i_rating)
End Sub
Code: Select all
'==========================================================================
'
' MediaMonkey Script
'
' NAME: Predefined Tempo Script v1.0
'
' AUTHOR: Peke
' DATE : 18.05.2005
'
' INSTALL: Change Defaults in "Variable Configuration" Section of this file
'
'==========================================================================
'==========================================================================
' Variable Definition (Do Not Change)
'==========================================================================
' Tempo Variables
Dim Str_Tempo1, Str_Tempo2, Str_Tempo3, Str_Tempo4, Str_Tempo5, Str_Tempo6, Str_Tempo7,
Str_Tempo8, Str_Tempo9, Str_Tempo10
' Hotkey Variables
Dim Use_Shift, Use_Ctrl, Use_Alt
'==========================================================================
' Variable Configuration
'==========================================================================
'Set Value to TRUE/FALSE if you want to it use in HotKey
Use_Shift = FALSE
Use_Ctrl = FALSE
Use_Alt = FALSE
'Change Tempos According to your needs
Str_Tempo1 = "Upbeat"
Str_Tempo2 = "Medium"
Str_Tempo3 = "Mellow"
Str_Tempo4 = "Country"
Str_Tempo5 = "Reggae"
Str_Tempo6 = "Hip-Hop"
Str_Tempo7 = "Alternative"
Str_Tempo8 = "Comedy"
Str_Tempo9 = "Sountrack"
Str_Tempo10 = "Pop"
'===< CONFIGUTARTION ENDED >===============================================
'==========================================================================
' MediaMonkey On Start Procedure
'==========================================================================
Sub OnStartup
Dim HotKeyRing
HotKeyRing = ""
If Use_Shift Then
HotKeyRing = HotKeyRing&"Shift+"
End if
If Use_Ctrl Then
HotKeyRing = HotKeyRing&"Ctrl+"
End if
If Use_Alt Then
HotKeyRing = HotKeyRing&"Alt+"
End if
Dim ETempo
Set ETempo = SDB.UI.addMenuItemSub(SDB.UI.Menu_Edit,0,0)
ETempo.caption = "Change Tempo"
ETempo.IconIndex = 58
ETempo.useScript = Script.ScriptPath
Dim Tempo1
Set Tempo1 = SDB.UI.AddMenuItem(ETempo,0,0)
Tempo1.Caption = "#1 "&Str_Tempo1
Tempo1.OnClickFunc = "PredefinedTempo"
Tempo1.UseScript = Script.ScriptPath
Tempo1.IconIndex = 18
Tempo1.ShortCut = HotKeyRing&"u"
Dim Tempo2
Set Tempo2 = SDB.UI.AddMenuItem(ETempo,0,0)
Tempo2.Caption = "#2 "&Str_Tempo2
Tempo2.OnClickFunc = "PredefinedTempo"
Tempo2.UseScript = Script.ScriptPath
Tempo2.IconIndex = 18
Tempo2.ShortCut = HotKeyRing&"e"
Dim Tempo3
Set Tempo3 = SDB.UI.AddMenuItem(ETempo,0,0)
Tempo3.Caption = "#3 "&Str_Tempo3
Tempo3.OnClickFunc = "PredefinedTempo"
Tempo3.UseScript = Script.ScriptPath
Tempo3.IconIndex = 18
Tempo3.ShortCut = HotKeyRing&"m"
Dim Tempo4
Set Tempo4 = SDB.UI.AddMenuItem(ETempo,0,0)
Tempo4.Caption = "#4 "&Str_Tempo4
Tempo4.OnClickFunc = "PredefinedTempo"
Tempo4.UseScript = Script.ScriptPath
Tempo4.IconIndex = 18
Tempo4.ShortCut = HotKeyRing&"4"
Dim Tempo5
Set Tempo5 = SDB.UI.AddMenuItem(ETempo,0,0)
Tempo5.Caption = "#5 "&Str_Tempo5
Tempo5.OnClickFunc = "PredefinedTempo"
Tempo5.UseScript = Script.ScriptPath
Tempo5.IconIndex = 18
Tempo5.ShortCut = HotKeyRing&"5"
Dim Tempo6
Set Tempo6 = SDB.UI.AddMenuItem(ETempo,0,0)
Tempo6.Caption = "#6 "&Str_Tempo6
Tempo6.OnClickFunc = "PredefinedTempo"
Tempo6.UseScript = Script.ScriptPath
Tempo6.IconIndex = 18
Tempo6.ShortCut = HotKeyRing&"6"
Dim Tempo7
Set Tempo7 = SDB.UI.AddMenuItem(ETempo,0,0)
Tempo7.Caption = "#7 "&Str_Tempo7
Tempo7.OnClickFunc = "PredefinedTempo"
Tempo7.UseScript = Script.ScriptPath
Tempo7.IconIndex = 18
Tempo7.ShortCut = HotKeyRing&"7"
Dim Tempo8
Set Tempo8 = SDB.UI.AddMenuItem(ETempo,0,0)
Tempo8.Caption = "#8 "&Str_Tempo8
Tempo8.OnClickFunc = "PredefinedTempo"
Tempo8.UseScript = Script.ScriptPath
Tempo8.IconIndex = 18
Tempo8.ShortCut = HotKeyRing&"8"
Dim Tempo9
Set Tempo9 = SDB.UI.AddMenuItem(ETempo,0,0)
Tempo9.Caption = "#9 "&Str_Tempo9
Tempo9.OnClickFunc = "PredefinedTempo(9)"
Tempo9.UseScript = Script.ScriptPath
Tempo9.IconIndex = 18
Tempo9.ShortCut = HotKeyRing&"9"
Dim Tempo0
Set Tempo0 = SDB.UI.AddMenuItem(ETempo,0,0)
Tempo0.Caption = "#10 "&Str_Tempo10
Tempo0.OnClickFunc = "PredefinedTempo"
Tempo0.UseScript = Script.ScriptPath
Tempo0.IconIndex = 18
Tempo0.ShortCut = HotKeyRing&"0"
End Sub
Sub EditTempo(Str_Tempo)
Dim list, itm, i
If SDB.SelectedSongList.count = 0 Then
Result = SDB.MessageBox( "No tracks Selected!", mtError, Array(mbOk))
Exit Sub
End If
Set list = SDB.SelectedSongList
For i=0 To list.count-1
Set itm = list.Item(i)
itm.Tempo = Str_Tempo
itm.UpdateDB
Next
End Sub
Sub PredefinedTempo(Item)
If Left(Item.Caption,3) = "#10" Then
EditTempo(Right(Item.Caption,Len(Item.Caption)-4))
Else
EditTempo(Right(Item.Caption,Len(Item.Caption)-3))
End If
End Sub