Same Script - New Method - New Name
I am using
Player.Stop now, instead of
Player.Pause, because I have discovered that
Player.Stop does not cut off a little bit of the prior song and play it after the gap, the way
Player.Pause does. This is good! I also found out how to turn off the progress indicator when the user starts the next song manually (by pressing (>) during the gap). This is also good! The only thing I am missing now, is a way to suppress the gap when I manually start a new song or set of songs.
Any suggestions anyone?
Is there any way to detect changes to the
next song of the
now playing list?
I changed the name of the script, because the old name reflects the old method used to create the gap. I like the new name better.
Code: Select all
'======================================================================
' MediaMonkey\Scripts\Auto\Gap.vbs
'
' Creates a gap between each song.
' Can be turned on and off with a button on the toolbar.
'
' 2008-02-02 - Soren Werk - www.tangoman.dk
'
' ToDo:
' Defaults configurable in Options.
' No gap when manual start of new song or set of songs.
' Gap after "this" song instead of before next.
'======================================================================
Option Explicit
Const GapSeconds = 15
Const GapDefaultOn = True
Dim GapButton
Dim GapProgress
Dim GapTimer
Dim FirstSong : FirstSong = True
Dim AfterGap : AfterGap = False
Sub OnStartUp()
InitButton
InitPlayer
InitTimer
End Sub
Sub InitButton()
Set GapButton = SDB.UI.AddMenuItem(SDB.UI.Menu_TBStandard,0,0)
GapButton.IconIndex = 2
GapButton.Caption = "Turn " & GapSeconds & " seconds gap on and off"
Script.RegisterEvent GapButton, "OnClick", "GapButtonOnClick"
If GapDefaultOn Then
GapButtonOnClick(GapButton)
End If
End Sub
Sub InitPlayer()
Script.RegisterEvent SDB, "OnPlay", "PlayerOnPlay"
' Script.RegisterEvent SDB, "WhichEvent??", "SetFirstSong"
End Sub
Sub InitTimer()
Set GapTimer = SDB.CreateTimer(1000)
GapTimer.Enabled = False
Script.RegisterEvent GapTimer, "OnTimer", "GapOnTimer"
End Sub
'======================================================================
Sub GapButtonOnClick(Button)
Button.Checked = not Button.Checked
End Sub
Sub PlayerOnPlay()
GapTimer.Enabled = False
Set GapProgress = Nothing
If GapButton.Checked and not FirstSong and not AfterGap Then
SDB.Player.Stop
AfterGap = True
Set GapProgress = SDB.Progress
GapProgress.MaxValue = GapSeconds
GapProgress.Text="Gap " & GapSeconds & " seconds."
GapTimer.Enabled = True
Else
AfterGap = False
End If
FirstSong = False
End Sub
Sub SetFirstSong()
FirstSong = True
End Sub
Sub GapOnTimer(Timer)
GapProgress.Increase
GapProgress.Text="Gap " & GapSeconds - GapProgress.Value & " seconds."
If GapProgress.Value >= GapProgress.MaxValue Then
If not SDB.Player.isPlaying Then
SDB.Player.Play
End If
GapTimer.Enabled = False
Set GapProgress = Nothing
End If
End Sub