Auto-stop (stop at end of every song)

Download and get help for different MediaMonkey Addons.

Moderators: Peke, Gurus

bmeyns
Posts: 2
Joined: Mon Nov 15, 2010 6:35 am

Auto-stop (stop at end of every song)

Post by bmeyns » Mon Nov 15, 2010 6:45 am

Based on the SilenceBetweenSongs script by Eyal, I've made a basic variant: "stop after every song"
You can enable/disable this option from the Play menu-items

Code: Select all

    ' Stop at end of song script v1.0
    ' By bmeyns, 2010.11.15 (based on SilenceBetweenSongs.vbs by Eyal)
    '
    ' This script adds an entry in Play menu that let you
    ' enable/disable a default stopping at end of a song.
    ' Requires MediaMonkey 3.1.0.1218 or newer (?)
    '
    ' Location: MediaMonkey\Scripts\Auto\StopAtEndOfSong.vbs
    '------------------
    Option Explicit

    Dim AutoStopEnabled : AutoStopEnabled = True

    Dim AppTitle : AppTitle = "StopAtEndOfSong"
    Dim Version : Version = "1.0"
    Dim MenuItem

    '------------------
    Sub OnStartup
      InitButton
      AutoStop
    End Sub 

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

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

       Set MenuItem = SDB.UI.AddMenuItem(SDB.UI.Menu_Play,4,1)
        MenuItem.Caption = "Auto-stop *"
       Script.RegisterEvent MenuItem, "OnClick", "ToggleAutoStop"
        MenuItem.Visible = True
       MenuItem.Checked = AutoStopEnabled
       
        ' Child of [Player] in the options:
        SDB.UI.AddOptionSheet "Auto-stop", Script.ScriptPath, "InitSheet", "SaveSheet", -2
    End Sub

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

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

    Sub AutoStop
        If AutoStopEnabled Then
           Script.RegisterEvent SDB, "OnPlay", "PlayerOnPlay"
           '--Script.RegisterEvent SDB, "OnTrackEnd", "PlayerTrackEnd"
        Else
            Script.UnregisterEvents SDB
            SDB.Player.StopAfterCurrent = False
        End If
    End Sub

    '------------------
    Sub PlayerOnPlay()
      If AutoStopEnabled Then
        SDB.Player.StopAfterCurrent = True
      End If
    End Sub

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

       Set oPanel1 = SDB.UI.NewGroupBox(Sheet)
       oPanel1.Common.SetRect 100,80,240,50
       oPanel1.Caption = "Auto-stop"

       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 = "Automatically stops at the end of every song"
       End With

       Set oCheck1 = SDB.UI.NewCheckBox(oPanel1)
       With oCheck1
            .Caption = "Enable"
           .Common.Left = 25
           .Common.Top = 25
           .Common.ControlName = "ChEnable"
            .Checked = AutoStopEnabled
        End With
       
    End Sub


    '---------------------
    Sub SaveSheet(Sheet)
       Dim v
        Set v = Sheet.Common.ChildControl("ChEnable")
        If v.Checked <> AutoStopEnabled then
            ToggleAutoStop 0
        End If
        SDB.IniFile.BoolValue(AppTitle,"Enabled") = AutoStopEnabled         'Not necessary????
    End Sub

Peke
Posts: 11201
Joined: Tue Jun 10, 2003 7:21 pm
Location: Serbia
Contact:

Re: Auto-stop (stop at end of every song)

Post by Peke » Sun Dec 26, 2010 7:37 pm

Nice Script, simple but useful.
Best regards,
Pavle
MediaMonkey lead QA/Tech Support guru
Admin of Free MediaMonkey addon Site HappyMonkeying
Image
Image
How to add Images to forum

Guest

Re: Auto-stop (stop at end of every song)

Post by Guest » Tue May 15, 2012 6:43 am

Does this work in V4. I installed it and now all files stop.

Thanks

MMFrLife
Posts: 2774
Joined: Fri Oct 26, 2012 9:04 pm

Re: Auto-stop (stop at end of every song)

Post by MMFrLife » Wed Jan 27, 2016 11:51 am

Guest wrote:Does this work in V4. I installed it and now all files stop.

Thanks
I have no problem using it with 4.1.9.1764 portable
MM user since 2003 (lifetime since 2012) "Trying to imagine life without music gives me a headache"
track properties; dir/fn mask configurations; check out ZvezdanD's scripts
MMW 4.1.18.1842b; fav scripts > RegExp Find & Replace 5.1.0; Magic Nodes 5.1.0; Advanced Duplicate Find & Fix 3.8.2;
Backup 6.0; Clear Now Playing Button 1.2
...always back it up, especially before doing anything major!!!
Win. explorer alt. for power users [free]; great file/folder renamer [used by nasa]

Post Reply