by Owyn » Sat Jan 03, 2009 5:42 am
Worked fine. I made some minor changes but that was trivial once I had your script to start with.
I checked the
Wiki and could not see any event available for Play Complete. Oh well.
Code: Select all
' MediaMonkey3 Script
' LogPlays.vbs
Option Explicit
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Sub OnStartUp()
Script.RegisterEvent SDB, "OnPlay", "OnPlay"
Script.RegisterEvent SDB, "OnStop", "OnStop"
Script.RegisterEvent SDB, "OnPause", "OnPause"
Script.RegisterEvent SDB, "OnSeek", "OnSeek"
Log "***Started***"
End Sub
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Sub OnPlay()
Log "Play"
End Sub
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Sub OnPause()
Log "Pause"
End Sub
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Sub OnStop()
Log "Stop"
End Sub
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Sub OnSeek()
Log "Seek"
End Sub
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Sub Log(sText)
Dim oLogFile
Dim dTime
Set oLogFile = CreateObject("Scripting.FileSystemObject").OpenTextFile _
(Script.ScriptPath & ".log", 8, True)
dTime = Timer
oLogFile.WriteLine Now & Mid(FormatNumber(dTime - Int(dTime), 3), 2) _
& " - " & sText & " - " & SDB.Player.CurrentSong.Path
oLogFile.Close
End Sub
Appreciate the appending to the log. I sometimes keep the log open during testing and edit in notes about the test. e.g.
Code: Select all
****Start of new test.
03/01/2009 4:53:23 AM.643 - Play - C:\Users\Public\Music\Willie Nelson\Red Headed Stranger\03 - Time of the Preacher Theme.mp3
03/01/2009 4:53:23 AM.648 - Play - C:\Users\Public\Music\Willie Nelson\Red Headed Stranger\03 - Time of the Preacher Theme.mp3
03/01/2009 4:54:36 AM.342 - Play - C:\Users\Public\Music\Willie Nelson\Red Headed Stranger\04 - Medley - Blue Rock Montana - Red Headed Stranger.mp3
03/01/2009 4:54:36 AM.346 - Play - C:\Users\Public\Music\Willie Nelson\Red Headed Stranger\04 - Medley - Blue Rock Montana - Red Headed Stranger.mp3
03/01/2009 4:56:42 AM.613 - Play - C:\Users\Public\Music\Willie Nelson\Red Headed Stranger\07 - Time of the Preacher Theme.mp3
03/01/2009 4:56:42 AM.615 - Play - C:\Users\Public\Music\Willie Nelson\Red Headed Stranger\07 - Time of the Preacher Theme.mp3
03/01/2009 4:57:09 AM.230 - Play - C:\Users\Public\Music\Willie Nelson\Red Headed Stranger\08 - Just as I Am.mp3
03/01/2009 4:57:09 AM.232 - Play - C:\Users\Public\Music\Willie Nelson\Red Headed Stranger\08 - Just as I Am.mp3
*****Duplicate Plays. Crossfade??****
*****Exited MM. Munged Last.Fm password. Restart MM and disable crossfade*****
03/01/2009 5:21:31 AM.936 - ***Started*** - C:\Users\Public\Music\Willie Nelson\Red Headed Stranger\09 - Denver.mp3
03/01/2009 5:21:41 AM.496 - Play - C:\Users\Public\Music\Willie Nelson\Red Headed Stranger\10 - O'er the Waves.mp3
03/01/2009 5:21:41 AM.496 - Play - C:\Users\Public\Music\Willie Nelson\Red Headed Stranger\10 - O'er the Waves.mp3
**Fixed last.fm password via service**
**Still have duplicate plays with Crossfade disabled**
03/01/2009 5:29:38 AM.506 - Play - C:\Users\Public\Music\Willie Nelson\Red Headed Stranger\11 - Down Yonder.mp3
03/01/2009 5:29:38 AM.508 - Play - C:\Users\Public\Music\Willie Nelson\Red Headed Stranger\11 - Down Yonder.mp3
03/01/2009 5:31:30 AM.936 - Play - C:\Users\Public\Music\Willie Nelson\Red Headed Stranger\16 - Bach Minuet in G.mp3
03/01/2009 5:31:30 AM.939 - Play - C:\Users\Public\Music\Willie Nelson\Red Headed Stranger\16 - Bach Minuet in G.mp3
Noticed that I am getting duplicate OnPlay events. DIIK.
Thanks again for the help.
Worked fine. I made some minor changes but that was trivial once I had your script to start with.
I checked the [url=http://www.mediamonkey.com/wiki/index.php/SDBApplication#ISDBApplicationEvents_members]Wiki[/url] and could not see any event available for Play Complete. Oh well.
[code]' MediaMonkey3 Script
' LogPlays.vbs
Option Explicit
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Sub OnStartUp()
Script.RegisterEvent SDB, "OnPlay", "OnPlay"
Script.RegisterEvent SDB, "OnStop", "OnStop"
Script.RegisterEvent SDB, "OnPause", "OnPause"
Script.RegisterEvent SDB, "OnSeek", "OnSeek"
Log "***Started***"
End Sub
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Sub OnPlay()
Log "Play"
End Sub
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Sub OnPause()
Log "Pause"
End Sub
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Sub OnStop()
Log "Stop"
End Sub
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Sub OnSeek()
Log "Seek"
End Sub
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Sub Log(sText)
Dim oLogFile
Dim dTime
Set oLogFile = CreateObject("Scripting.FileSystemObject").OpenTextFile _
(Script.ScriptPath & ".log", 8, True)
dTime = Timer
oLogFile.WriteLine Now & Mid(FormatNumber(dTime - Int(dTime), 3), 2) _
& " - " & sText & " - " & SDB.Player.CurrentSong.Path
oLogFile.Close
End Sub
[/code]
Appreciate the appending to the log. I sometimes keep the log open during testing and edit in notes about the test. e.g.
[code]****Start of new test.
03/01/2009 4:53:23 AM.643 - Play - C:\Users\Public\Music\Willie Nelson\Red Headed Stranger\03 - Time of the Preacher Theme.mp3
03/01/2009 4:53:23 AM.648 - Play - C:\Users\Public\Music\Willie Nelson\Red Headed Stranger\03 - Time of the Preacher Theme.mp3
03/01/2009 4:54:36 AM.342 - Play - C:\Users\Public\Music\Willie Nelson\Red Headed Stranger\04 - Medley - Blue Rock Montana - Red Headed Stranger.mp3
03/01/2009 4:54:36 AM.346 - Play - C:\Users\Public\Music\Willie Nelson\Red Headed Stranger\04 - Medley - Blue Rock Montana - Red Headed Stranger.mp3
03/01/2009 4:56:42 AM.613 - Play - C:\Users\Public\Music\Willie Nelson\Red Headed Stranger\07 - Time of the Preacher Theme.mp3
03/01/2009 4:56:42 AM.615 - Play - C:\Users\Public\Music\Willie Nelson\Red Headed Stranger\07 - Time of the Preacher Theme.mp3
03/01/2009 4:57:09 AM.230 - Play - C:\Users\Public\Music\Willie Nelson\Red Headed Stranger\08 - Just as I Am.mp3
03/01/2009 4:57:09 AM.232 - Play - C:\Users\Public\Music\Willie Nelson\Red Headed Stranger\08 - Just as I Am.mp3
*****Duplicate Plays. Crossfade??****
*****Exited MM. Munged Last.Fm password. Restart MM and disable crossfade*****
03/01/2009 5:21:31 AM.936 - ***Started*** - C:\Users\Public\Music\Willie Nelson\Red Headed Stranger\09 - Denver.mp3
03/01/2009 5:21:41 AM.496 - Play - C:\Users\Public\Music\Willie Nelson\Red Headed Stranger\10 - O'er the Waves.mp3
03/01/2009 5:21:41 AM.496 - Play - C:\Users\Public\Music\Willie Nelson\Red Headed Stranger\10 - O'er the Waves.mp3
**Fixed last.fm password via service**
**Still have duplicate plays with Crossfade disabled**
03/01/2009 5:29:38 AM.506 - Play - C:\Users\Public\Music\Willie Nelson\Red Headed Stranger\11 - Down Yonder.mp3
03/01/2009 5:29:38 AM.508 - Play - C:\Users\Public\Music\Willie Nelson\Red Headed Stranger\11 - Down Yonder.mp3
03/01/2009 5:31:30 AM.936 - Play - C:\Users\Public\Music\Willie Nelson\Red Headed Stranger\16 - Bach Minuet in G.mp3
03/01/2009 5:31:30 AM.939 - Play - C:\Users\Public\Music\Willie Nelson\Red Headed Stranger\16 - Bach Minuet in G.mp3
[/code]
Noticed that I am getting duplicate OnPlay events. DIIK.
Thanks again for the help.