Page 2 of 2
Re: Is it possible..
Posted: Sun Sep 20, 2009 3:19 pm
by liamgarrett
Sorry to waste your time, everybody, but I think it's awesome you guys know how to do this kind of stuff. I guess I sound a little like a Luddite or something, but I think it's unbelievable what you guys can do with just a little bit of code.
Keep it up!
-Liam
Re: Is it possible..
Posted: Tue Apr 20, 2010 12:36 pm
by Guest
I know this is not a new script by any means but I think its great and I'm glad I found it. It deserves some real publicity. A lot of people would use ratings if they were prompted and in the end it would make them happier to have songs rated.
Guest wrote:This is a GREAT script for those who rate songs. My problem was that I found myself distracted and not listening to the songs every time. I needed a replay button. So I eliminated the OK button and replaced it with a Replay Song button. Now if you click a rating, the song is rated and the form exits. If you click replay song, the song replays and the form exits.
I could have never done this from scratch, so thank you Steegy and others.
Code: Select all
'====================================================================================
' MEDIAMONKEY SCRIPT: RatePlayedSong v1.1 (last updated 2007-07-04) by Steegy
'
' Shows a dialog when a song is started, to rate the previous played song.
'====================================================================================
Option Explicit
Dim BtnCapt : BtnCapt = Array("5", "4½", "4", "3½", "3", "2½", "2", "1½", "1", "½", "0")
Dim Rpl
Dim PreviousSong
Dim DoneSettingRating
Dim MI
Sub OnStartup
If SDB.IniFile.StringValue("RatePlayedSong", "Enabled") = "" Then
SDB.IniFile.BoolValue("RatePlayedSong", "Enabled") = True
End If
Set MI = SDB.UI.AddMenuItem(SDB.UI.Menu_Scripts, 1, 1)
MI.Caption = "Rate Played Song"
MI.Hint = "Activate/deactivate dialog for rating played song"
MI.Checked = SDB.IniFile.BoolValue("RatePlayedSong", "Enabled")
Script.RegisterEvent MI, "OnClick", "MI_OnClick"
Script.RegisterEvent SDB, "OnPlay", "RatePlayedSong"
End Sub
Sub RatePlayedSong
If Rpl = 1 Then
Rpl = 0
Exit Sub
Else
If Not IsEmpty(PreviousSong) And MI.Checked Then
If PreviousSong.Rating = -1 Then
SDB.Player.Pause
SDB.Player.PlaybackTime = 0
Dim PreviousSongRating : PreviousSongRating = PreviousSong.Rating
Dim Ret : Ret = GetForm().ShowModal
If Ret <> 1 Then ' If Cancel or Rated
SDB.Player.Play
End If
End If
End If
End If
Set PreviousSong = SDB.Player.CurrentSong
End Sub
Function GetForm
Set GetForm = SDB.Objects("RatePlayedSong_Form")
' Initialize the two variables here because they will be used in both sides of the conditional
Dim lblTit
Dim lblArt
If GetForm Is Nothing Then
Dim bheight : bheight = 23
Dim bwidth : bwidth = 35
Set GetForm = SDB.UI.NewForm
GetForm.Common.SetRect 100, 100, 360, 190
GetForm.BorderStyle = 3 ' Resizable
GetForm.FormPosition = 4 ' Screen Center
GetForm.SavePositionName = "RatePlayedSong_Form"
GetForm.Caption = "Rate Previously Played Song"
Set SDB.Objects("RatePlayedSong_Form") = GetForm
Set lblTit = SDB.UI.NewLabel(GetForm)
lblTit.Caption = "Title: " & PreviousSong.Title
lblTit.Common.Left = 10
lblTit.Common.Top = 14
' Initialize a new named label object, so we can refer to it later
Set SDB.Objects("RatePlayedSong_Form_lblTit") = lblTit
Set lblArt = SDB.UI.NewLabel(GetForm)
lblArt.Caption = "Artist: " & PreviousSong.ArtistName
lblArt.Common.Left = 10
lblArt.Common.Top = lblTit.Common.Top + lblTit.Common.Height +7
' same as above
Set SDB.Objects("RatePlayedSong_Form_lblArt") = lblArt
Dim i, btnPcnt
For i = 0 To 10
Set btnPcnt = SDB.UI.NewButton(GetForm)
btnPcnt.Caption = BtnCapt(i)
btnPcnt.Common.MinHeight = i
btnPcnt.Common.Height = bheight
btnPcnt.Common.Width = bwidth
btnPcnt.Common.Top = lblArt.Common.Top + lblArt.Common.Height + 10 + (i MOD 2)*bheight
btnPcnt.Common.Left = 50 + i*(bwidth - bwidth/2 + 5)
btnPcnt.ModalResult = 3
Script.RegisterEvent btnPcnt.Common, "OnClick", "RateButton_OnClick"
Next
Dim btnrepl : Set btnrepl = SDB.UI.NewButton(GetForm)
btnrepl.Caption = "Replay Song"
btnrepl.Common.SetRect GetForm.Common.Width/2 - 155, lblArt.Common.Top + lblArt.Common.Height + 10 + 2*bheight + 10 + 5, 150, bheight
btnrepl.Default = True
btnrepl.ModalResult = 1
Script.RegisterEvent btnrepl.Common, "OnClick", "ReplaySong_OnClick"
Dim btnCancel : Set btnCancel = SDB.UI.NewButton(GetForm)
btnCancel.Caption = "Cancel Changes"
btnCancel.Common.SetRect GetForm.Common.Width/2 + 5, Btnrepl.Common.Top, 150, bheight
btnCancel.Cancel = True
btnCancel.ModalResult = 2
Else
' this bit is for when the form appears for not the first time
' capture the named label objects in lblTit and lblArt and update their content
Set lblTit = SDB.Objects("RatePlayedSong_Form_lblTit")
lblTit.Caption = "Title: " & PreviousSong.Title
Set lblArt = SDB.Objects("RatePlayedSong_Form_lblArt")
lblArt.Caption = "Artist: " & PreviousSong.ArtistName
End If
End Function
Sub RateButton_OnClick(RateButton)
PreviousSong.Rating = 100 - 10 * RateButton.Common.MinHeight
PreviousSong.UpdateDB
End Sub
Sub MI_OnClick(MI)
MI.Checked = Not MI.Checked
SDB.IniFile.BoolValue("RatePlayedSong", "Enabled") = MI.Checked
End Sub
'Add Replay Song Script
Sub ReplaySong_OnClick(ReplaySong)
Rpl = 1
SDB.Player.Previous
End Sub
Re: Is it possible..
Posted: Tue Aug 17, 2010 4:45 am
by Speed Pete
I could use a variation of this script, but I am not able to write it myself
Perhaps anyone is interested to do some modifications?:
I often have to rate many songs, but to do this there is no need to hear the complete song. So I want MM to play a song in the playlist. While playing I want to input the rating via a shortcut or using some buttons - does not matter how. After receiving the rating I want MM to skip to the next song and start all over to rate this.
It would be great, if seomone wants to do that.

Re: Is it possible..
Posted: Tue Aug 17, 2010 9:30 am
by projectfallback
You should be able to go to Options > Hotkeys to see a list of hotkeys, ticking them as Global means they work when it is not in focus.
Ctrl+Alt+1 rates currently playing track 1 star
Ctrl+Alt+4 rates currently playing track 4 stars etc
Re: Is it possible..
Posted: Tue Aug 17, 2010 11:07 am
by Speed Pete

Oh my God - so easy... Thank you!
Re: Is it possible..
Posted: Fri Aug 20, 2010 11:05 am
by DocWeini
I think I'm blind - but is there any other action that can be taken except for turning the script on and off?
Plus: I need the possibility to stop the player after
each song to rate a big bunch of songs over again.
Thx for any help

Re: Is it possible..
Posted: Thu Jul 04, 2013 3:55 pm
by DScoffers
Resurrecting a very old thread here - is there a more up-to-date place to discuss this script?
I've been using this script for a long time now, but it seems to have stopped working recently. I'm not sure when.
It's definitely not a permissions issue.
Manually setting a rating in MM sets the correct tag, but when rating using the script, nothing happens.
Version: 4.0.7.1511
Can anyone provide any assistance?
Re: Is it possible..
Posted: Sat May 03, 2014 3:12 am
by DScoffers2
I found a solution to my problem, so I thought I'd post it here for anyone else searching for an answer.
The current script will update the rating in the database, but not edit the tags of the mp3 file.
I sync files between multiple locations so this wouldn't work for me.
Towards the end of the script, I have edited it to include the line "PreviousSong.WriteTags" so that it updates the rating in the database and writes the rating to the tag in the mp3 file.
Code: Select all
Sub RateButton_OnClick(RateButton)
PreviousSong.Rating = 100 - 10 * RateButton.Common.MinHeight
PreviousSong.UpdateDB
PreviousSong.WriteTags
End Sub