Page 2 of 7

Re: Silence Between Songs v1.0 [MM3]

Posted: Tue Apr 27, 2010 2:36 pm
by nohitter151
dsgoen wrote:I get an Product Installation Error with this script. MediaMonkey Version 3.2.0.1294.

It does show up in the Extensions pane, but nothing displays in the Options pane.

Any suggestions? I really need this function for classical music.

David
http://www.mediamonkey.com/support/inde ... ticleid=59

Re: Silence Between Songs v1.0 [MM3]

Posted: Thu Apr 29, 2010 3:41 pm
by onnotabak
I've enhanced the code in order to take care of repeat and shuffle.
Also the next song is selected before the pause rather than after.
If pressed play during the gap the next song is started immediatly.
This shortens the gap if needed.

Code: Select all

' Gap / Silence Between Songs script v2.1
' By Eyal, 2009.09.16
' By Onno Tabak 2010-04-21 with small part of Gap.vbs by Soren Werk
'
' This script adds an entry in Play menu that let you
' enable/disable a silence time between playing songs.
' Delay time is configurable through Options|Player|SBS.
' Requires MediaMonkey 3.1.0.1218 or newer.
'
' Repeat and Shuffle is accounted for.
' Next song selected before gap
'
' Location: MediaMonkey\Scripts\Auto\SilenceBetweenSongs.vbs
'------------------
Option Explicit

'Set Silence Time in seconds (default = 5):
Dim SilenceTime : SilenceTime = 5
Dim SilenceEnabled : SilenceEnabled = True
Dim GapProgress
Dim GapTimer

Dim AppTitle : AppTitle = "SilenceBetweenSongs"
Dim Version : Version = "2.0"
Dim MenuItem

'------------------
Sub OnStartup
  InitButton
  SilenceBetweenSongs
  InitTimer
End Sub  

Sub InitButton()  
	SDB.IniFile.StringValue(AppTitle,"Version") = Version   '"2.0"

    If Not SDB.IniFile.ValueExists(AppTitle,"Enabled") Then
    	SDB.IniFile.BoolValue(AppTitle,"Enabled") = SilenceEnabled
    End If

    If Not SDB.IniFile.ValueExists(AppTitle,"SilenceTime") Then
    	SDB.IniFile.StringValue(AppTitle,"SilenceTime") = SilenceTime
    End If

    If Not SDB.IniFile.ValueExists(AppTitle,"CrossfadeState") Then
    	SDB.IniFile.BoolValue(AppTitle,"CrossfadeState") = SDB.Player.IsCrossfade
    End If

    SilenceTime = SDB.IniFile.StringValue(AppTitle,"SilenceTime")
    SilenceEnabled = SDB.IniFile.BoolValue(AppTitle,"Enabled")

	Set MenuItem = SDB.UI.AddMenuItem(SDB.UI.Menu_Play,4,2)
    MenuItem.Caption = "Silence between songs"
	Script.RegisterEvent MenuItem, "OnClick", "ToggleSilence"
    MenuItem.Visible = True
	MenuItem.Checked = SilenceEnabled
	
    ' Child of [Player] in the options:
    SDB.UI.AddOptionSheet "Silence between songs", Script.ScriptPath, "InitSheet", "SaveSheet", -2
End Sub

'------------------
Sub ToggleSilence(p)
    SilenceEnabled = Not SilenceEnabled
    MenuItem.Checked = SilenceEnabled
    SDB.IniFile.BoolValue(AppTitle,"Enabled") = SilenceEnabled

    If SilenceEnabled then
        SDB.IniFile.BoolValue(AppTitle,"CrossfadeState") = SDB.Player.IsCrossfade
        SDB.Player.IsCrossfade = False
    Else
        SDB.Player.IsCrossfade = SDB.IniFile.BoolValue(AppTitle,"CrossfadeState")
    End If
    SilenceBetweenSongs    
End Sub

Sub SilenceBetweenSongs
    If SilenceEnabled Then
       Script.RegisterEvent SDB, "OnPlay", "PlayerOnPlay" 
       Script.RegisterEvent SDB, "OnTrackEnd", "PlayerTrackEnd"
    Else
        Script.UnregisterEvents SDB
        SDB.Player.StopAfterCurrent = False
    End If
End Sub

'------------------
Sub InitTimer()
  Set GapTimer = SDB.CreateTimer(1000)
  GapTimer.Enabled = False
  Script.RegisterEvent GapTimer, "OnTimer", "GapOnTimer"
End Sub

'------------------
Sub PlayerOnPlay()
  If SilenceEnabled Then
    SDB.Player.StopAfterCurrent = True
  End If
  If  GapTimer.Enabled = True Then  
    GapTimer.Enabled = False
    Set GapProgress = Nothing
  End If
End Sub

'-----------------------
Sub PlayerTrackEnd()
  If SilenceEnabled and (SDB.Player.CurrentSongIndex+1 < SDB.Player.PlayListCount or SDB.Player.IsRepeat or SDB.Player.IsShuffle) Then
    Set GapProgress = SDB.Progress
    GapProgress.MaxValue = SilenceTime
    GapProgress.Text="Gap " & SilenceTime & " seconds."
    GapTimer.Enabled = True
  Else
    GapTimer.Enabled = False
    Set GapProgress = Nothing
  End If
End Sub

Sub GapOnTimer(Timer)
  If GapProgress.Value = 0 Then
    SDB.Player.Next
  End If
  If GapTimer.Enabled = True Then
    GapProgress.Increase
    GapProgress.Text="Gap " & SilenceTime - GapProgress.Value & " seconds."
  End If
  If GapProgress.Value >= GapProgress.MaxValue Then
    SDB.Player.Play  
    GapTimer.Enabled = False
    Set GapProgress = Nothing
  End If
End Sub

'---------------------
Sub InitSheet(Sheet)
	Dim oPanel1, oCheck1, oSpin1

	With SDB.UI.NewLabel(Sheet)
		.Common.Left = 460
		.Common.Top = 5
		.Caption = "v" & Version
	End With
	
	With SDB.UI.NewLabel(Sheet)
		.Alignment = 2    'Center
		.Common.SetRect 100,30,100,40
		.Caption = "Adds silence between playing songs." & vbcrlf & _
                   "Can also be enabled/disabled through Play menu."
	End With

	Set oPanel1 = SDB.UI.NewGroupBox(Sheet)
	oPanel1.Common.SetRect 100,80,240,100
	oPanel1.Caption = "Delay between songs"

	Set oCheck1 = SDB.UI.NewCheckBox(oPanel1)
	With oCheck1
        .Caption = "Enable"
    	.Common.Left = 25
    	.Common.Top = 25
    	.Common.ControlName = "ChEnable"
        .Checked = SilenceEnabled
    End With
    
     Set oSpin1 = SDB.UI.NewSpinEdit(oPanel1)
     With oSpin1
         .Common.Left = 25
         .Common.Top = 55
         .Common.Width = 45
         .MinValue = 1
         .MaxValue = 15
         .Common.ControlName = "EdLength"
         .Value = SilenceTime
     End With

    With SDB.UI.NewLabel(oPanel1)
        .caption = "second(s)"
        .Common.Left = 80
        .Common.Top = 58
    End With
    
End Sub


'---------------------
Sub SaveSheet(Sheet)
 	Dim v

    Set v = Sheet.Common.ChildControl("ChEnable")
    If v.Checked <> SilenceEnabled then
        ToggleSilence 0
    End If

    'SDB.IniFile.BoolValue(AppTitle,"Enabled") = SilenceEnabled         'Not necessary
    SilenceTime = Sheet.Common.ChildControl("EdLength").Value
    SDB.IniFile.StringValue(AppTitle,"SilenceTime") = SilenceTime
End Sub

Re: Silence Between Songs v2.2 [MM3] updated 2010-05-01

Posted: Sat May 01, 2010 9:31 am
by Eyal
Thank you Onnotabak, that's great.
I added conditions to the code to stop playing after Shuffle has played all files, when Repeat is off.

Thanks to you, version 2.2 is now perfect.

-------------------
Download
2010-05-01 - V2.2
Via MediaFire : http://www.mediafire.com/file/ziemzaj5z ... ngs22.mmip
Via DataFileHost: http://www.datafilehost.com/download-645fd006.html

:~)

Re: Silence Between Songs v2.2 [MM3] updated 2010-05-01

Posted: Sat May 22, 2010 7:07 pm
by hays_r
I also get an error during installation. "Product installation error" from Windows 7 32 bit, as administrator, MM v. 3.2.0.1294

Re: Silence Between Songs v2.2 [MM3] updated 2010-05-01

Posted: Sat May 22, 2010 9:06 pm
by Eyal
Have you tried the last step in this eSupport?
If you're in Windows 7 and MediaMonkey is in the taskbar, right click the icon,
then right-click "MediaMonkey" and then Run as administrator.

Re: Silence Between Songs v2.2 [MM3] updated 2010-05-01

Posted: Mon Jul 19, 2010 9:01 pm
by fhoyos
Error #424 - Microsoft VBScript runtime error
Object required: 'GapProgress'
File: "C:\Program Files\MediaMonkey\Scripts\Auto\SilenceBetweenSongs.vbs", Line: 129, Column: 6

Please Help

Re: Silence Between Songs v2.2 [MM3] updated 2010-05-01

Posted: Tue Jul 20, 2010 12:45 pm
by Eyal
fhoyos wrote:Error #424 - Microsoft VBScript runtime error
Object required: 'GapProgress'
File: "C:\Program Files\MediaMonkey\Scripts\Auto\SilenceBetweenSongs.vbs", Line: 129, Column: 6
I'm sorry, I really don't know why you get this error.
This code part is increasing the progress bar when silence is generated. It was coded by Onnotabak.

You can try version 1.0 which doesn't use progress bar.
Please uninstall version 2.2 first. (menu Tools|Extensions)

Download Silence Between Songs v1.0:
http://www.mediafire.com/file/nmzjb2zym ... ngs10.mmip

Re: Silence Between Songs v2.2 [MM3] updated 2010-05-01

Posted: Tue Jul 20, 2010 8:38 pm
by fhoyos
Thanks Eyal
I will try

Re: Silence Between Songs v2.2 [MM3] updated 2010-05-01

Posted: Tue Aug 31, 2010 12:37 pm
by Roux
I was excited to come across this addon, but after installing it and running Media Monkey I get "error message #438 - Microsoft runtime error Object doesn't support 'SDB.Player.StopAfterCurrent'. And then a second error much the same.

When I turn on, or off, "Silence Between Songs" I get 'error executing script event'. I have MM 3.1.0.1256.

I'd like to fix this, or learn how to uninstall it to remove the opening error messages. Thanks

Re: Silence Between Songs v2.2 [MM3] updated 2010-05-01

Posted: Tue Aug 31, 2010 1:06 pm
by nohitter151
Roux wrote:I was excited to come across this addon, but after installing it and running Media Monkey I get "error message #438 - Microsoft runtime error Object doesn't support 'SDB.Player.StopAfterCurrent'. And then a second error much the same.

When I turn on, or off, "Silence Between Songs" I get 'error executing script event'. I have MM 3.1.0.1256.

I'd like to fix this, or learn how to uninstall it to remove the opening error messages. Thanks
Update to MM 3.2.2. Your version is out-of-date.

Re: Silence Between Songs v2.2 [MM3] updated 2010-05-01

Posted: Tue Aug 31, 2010 2:11 pm
by Eyal
Sorry, I forget to mention system requirement for v2.x of this script.

V1.0 of the script requires MM 3.1.0.1218 or newer to work.
V2.x requires MM 3.1.2 or newer.

Thanks

Re: Silence Between Songs v2.2 [MM3] updated 2010-05-01

Posted: Tue Aug 31, 2010 3:45 pm
by Guest
"That was easy"... Thanks!

Re: Silence Between Songs v2.2 [MM3] updated 2010-05-01

Posted: Thu Oct 28, 2010 1:25 pm
by Ray Dupont
Thanks Eyal,
It works fine for me too, with a W7 Familial Edition and MM3.

Re: Silence Between Songs v2.2 [MM3] updated 2010-05-01

Posted: Tue Dec 07, 2010 7:24 pm
by artworksmetal
Just what the doctored ordered. W7,latest MMG. didn't even have to restart MM.

Thank you for your effort.

Re: Silence Between Songs v2.2 [MM3] updated 2010-05-01

Posted: Tue Dec 07, 2010 9:19 pm
by rovingcowboy
okay i just got this v1 eayl i'm slow ya know. but i got tired of my announcer fighting with the songs to say his comments.
so i'll have to space the songs out some more and did not want to edit more silent space on the songs. so hope this works. 8)
maybe i'll get v2 also. just in case i need more.