MonkeySqueeze Development V3.0.2.

This forum is for questions / discussions regarding development of addons / tweaks for MediaMonkey.

Moderator: Gurus

Re: MonkeySqueeze Development - Beta 110912

Postby Gingernut63 » Fri Sep 16, 2011 9:31 pm

Arghhh!!!!

Found a mistake in the 110912Beta which would stop the NAS settings from working. Have replaced 110912Beta with 110917Beta which will definitely work. Sorry for any inconvenience, version control needs to be reviewed :oops: .
MonkeySqueeze – Squeezing music into your life!
https://twitter.com/#!/MonkeySqueeze1
MonkeySqueeze Support: viewtopic.php?f=2&t=59515
MonkeySqueeze Development: viewtopic.php?f=19&t=59907
MediaMonkey user since 2005
Gingernut63
 
Posts: 188
Joined: Thu Jul 14, 2011 4:13 am

Re: MonkeySqueeze Development V2

Postby Gingernut63 » Thu Sep 22, 2011 11:13 pm

MonkeySqueeze – Squeezing music into your life!
https://twitter.com/#!/MonkeySqueeze1
MonkeySqueeze Support: viewtopic.php?f=2&t=59515
MonkeySqueeze Development: viewtopic.php?f=19&t=59907
MediaMonkey user since 2005
Gingernut63
 
Posts: 188
Joined: Thu Jul 14, 2011 4:13 am

Re: MonkeySqueeze Development V2

Postby Katteman » Sat Sep 24, 2011 3:36 pm

I detected some time ago a problem in MonkeySqueeze, but only recently I found the reason and a remedy.
When MediaMonkey is started without a track in the "Now Playing" window, you see 'MediaMonkey Player' for both Title and Track near the progress bar.
Clicking the enable/disable button in this case gives the error " Object Required 'SongValue' " when enabling the MonkeySqueeze script.
The origin of this error is the fact that the object "SDB.Player.CurrentSong" is not created when no track is selected.

The remedy is to check the presence of this object before requesting the track path in the function "SyncToggle".
I also moved the TrackPath code to another location where it is only executed during enable, and not when disabling.

Code: Select all
'**************************************************************
Function SyncToggle( itm )
   Dim TrackPath, Mnu

   If SDB.IniFile.BoolValue("MonkeySqueeze","SyncToggle") = False Then
      SDB.IniFile.BoolValue("MonkeySqueeze","SyncToggle") = True
      itm.IconIndex = SDB.RegisterIcon("Scripts\Auto\sbon.ico", 0)
      Call registerEvents
      If Not (SDB.Player.CurrentSong is Nothing) Then
        TrackPath = CheckPath(SDB.Player.CurrentSong)
        If SDB.IniFile.BoolValue("Synology","Enabled") = True Then
          TrackPath = Replace(TrackPath,"\","/")
        End If
        If SDB.IniFile.BoolValue("NAS","Enabled") = True Then
          TrackPath = Replace(TrackPath,SDB.IniFile.StringValue("MediaMonkey","MF"),SDB.IniFile.StringValue("SqueezeBox","MF"))
        End If
        'slimRequest(formatCommand("""playlist"", ""play"", """ + perlEscape(TrackPath) + """"))
      End If
      slimRequest(formatCommand("""time"", """ + CStr(SDB.Player.PlaybackTime*0.001 + 1) + """"))      'added 1 second to try to make up for net and lookup lag
   Else
      SDB.IniFile.BoolValue("MonkeySqueeze","SyncToggle") = False
      itm.IconIndex = SDB.RegisterIcon("Scripts\Auto\sboff.ico", 0)
      Call unregisterEvents
      slimRequest(formatCommand("""stop"""))
   End If
End Function
'**************************************************************

As you can see, I first check if CurrentSong exists. If not I skip all TrackPath related lines.
If you look at the code, you see that in the current version the lines always can be skipped, because the play-command is commented out. This means that the whole If-statement can be commented out. :wink:
But maybe in the future this command is being used again, so for safety I keep it in.

When I was reviewing the code for SyncToggle I remembered also the problem that the icon was not changing colors right away, but only after you moved the mouse away and then over the icon again.
I tried rearranging the statements into a more logic order and found out that it improved changing the icons. Hope that it is persistent.

Greetings,
Katteman
Last edited by Katteman on Sun Sep 25, 2011 6:29 am, edited 1 time in total.
Katteman
 
Posts: 9
Joined: Fri Sep 02, 2011 2:09 pm

Re: MonkeySqueeze Development V2

Postby mccstumble » Sat Sep 24, 2011 4:59 pm

@gingernut63
Thanks for the update with Ver2. Installed without a hitch and has been running fine since

I hadn't noticed the enable/disable issue until version 2 and can only assume I must have been using the function less in previous versions. I noticed earlier when I enabed MS nothing happened until I selected a new song or restarted MM. I don't recall the exact sequence and I didn't write down what was displayed in MM but in short I would say that it took a few attempts to enable MS. I don't recall any error messages though?

Thanks to katteman for the feedback and the solution.

Has anyone out there got any solutions to the lag problem that they can share on the post?

cheers

mccstumble
Music & Video Management: Mediamonkey Ver 4.0.0.1436Gold Lifetime
Music Server: Logitech Media Server (LMS) 7.7.0-33512
AddOns: MonkeySqueeze Ver 2.0 http://www.mediamonkey.com/forum/viewtopic.php?f=2&t=59515
On Demand Music: LastFM, Spotify via LMS
mccstumble
 
Posts: 44
Joined: Fri Jul 30, 2010 8:46 am

Re: MonkeySqueeze Development V2

Postby mccstumble » Sat Sep 24, 2011 5:02 pm

anyone know why MonkeySqueeze has disappeared from the Addons page?

mccstumble
Music & Video Management: Mediamonkey Ver 4.0.0.1436Gold Lifetime
Music Server: Logitech Media Server (LMS) 7.7.0-33512
AddOns: MonkeySqueeze Ver 2.0 http://www.mediamonkey.com/forum/viewtopic.php?f=2&t=59515
On Demand Music: LastFM, Spotify via LMS
mccstumble
 
Posts: 44
Joined: Fri Jul 30, 2010 8:46 am

Re: MonkeySqueeze Development V2

Postby Gingernut63 » Sat Sep 24, 2011 5:12 pm

Yes, It was me. Have arranged with rusty to change the logo. It will be down for a couple of hours. Sorry, forgot to post a notice.

After re-enabling MonkeySqueeze you may have to start, stop and restart the track to resume play on the Squeezebox system. See the user guide for more details.
MonkeySqueeze – Squeezing music into your life!
https://twitter.com/#!/MonkeySqueeze1
MonkeySqueeze Support: viewtopic.php?f=2&t=59515
MonkeySqueeze Development: viewtopic.php?f=19&t=59907
MediaMonkey user since 2005
Gingernut63
 
Posts: 188
Joined: Thu Jul 14, 2011 4:13 am

Re: MonkeySqueeze Development V2

Postby Katteman » Sun Sep 25, 2011 6:32 am

Sorry, but I posted a personalyzed version of the function SyncToggle, with the setup variables as constants.
The code in my previous message has been changed.

Greetings, Katteman
Katteman
 
Posts: 9
Joined: Fri Sep 02, 2011 2:09 pm

MonkeySqueeze V2 – Removing the Lag

Postby Gingernut63 » Sun Sep 25, 2011 5:55 pm

As you read this post you’ll realised that I’ve said some of this before, however this time I’m trying to define the approach instead of just broadcasting ideas.

What I want (Is it what you want?)

I want to manage my music, create playlists and play music using MediaMonkey. At any time I might like to play the same music over the Squeezebox system while playing on MediaMonkey. I can achieve this outcome now but I have the lag issue creating problems in the background. I find LMS to be a clunky interface with the music library so I don’t what to spend any time in LMS unless I’m using its plugins.

So what do we do? We can wait for the “Lone Programmer” to ride into MediaMonkey town and fix the evil Lag brothers. Like any optimist I would love that to happen (cue swooning women… or men) but instead of waiting maybe it would be best to start with less ideal goals; start with what might be achievable and work our way up. So I’ll list some (hopefully) simple goals we can concentrate on first. Most of these ideas have been posted before by booblers or me in this forum but I will endeavour to expand on them.

Short term goals:
1. Send the next track to be played to Logitech Media Server (LMS) so it will start buffering when it needs to, instead of waiting for MediaMonkey to send it after the current track finishes. Don’t know if this will work with the shuffle function in MediaMonkey. Reduction in lag time? Will depend on the PC setup but it could be reduced dramatically.

2. Monitor the track countdown time in the connected Squeezebox device or LMS. Start play in MediaMonkey when the track plays in LMS. There may need to be a programmable offset time to factor out the delay between LMS and MediaMonkey. Should work well with the first idea. Think of it as a bastardised sync function.

3. Your idea?

Long term goal:
- Sync MediaMonkey with Logitech Media Server

We need to have a focused approach if possible. If you have a simple idea that you think may alleviate the lag issue then let’s hear it. If you think I’m having a picnic with the fairies then let’s hear that as well, but please try to be constructive.

Gingernut63
MonkeySqueeze – Squeezing music into your life!
https://twitter.com/#!/MonkeySqueeze1
MonkeySqueeze Support: viewtopic.php?f=2&t=59515
MonkeySqueeze Development: viewtopic.php?f=19&t=59907
MediaMonkey user since 2005
Gingernut63
 
Posts: 188
Joined: Thu Jul 14, 2011 4:13 am

Re: MonkeySqueeze Development V2

Postby Katteman » Mon Sep 26, 2011 3:17 pm

I agree with these ideas. I was already thinking in the same direction.
Goal #2 is the least complicated, although for me it means waiting for 9 seconds. I see a strange behaviour in the progress bar of the Logitech Server. It starts at about 4 seconds, stops after a few seconds, jumps to zero and starts again. Avoiding this restart might decrease the time lag considerably.
I will start with stripping the script to reduce the OnPlay function to the minimum, and then starting to find a solution.

If I manage to achieve this goal, I wil start looking at the first goal.
Katteman
 
Posts: 9
Joined: Fri Sep 02, 2011 2:09 pm

Re: MonkeySqueeze Development V2

Postby stephanvdplas » Thu Oct 06, 2011 5:42 pm

Hello,

I´m trying this script, but it does not work. I think the reason is that my LMS is password protected and this script does not provide a password to the LMS. Can that be changed in a secure way?

Regards,
Stephan van der Plas
stephanvdplas
 
Posts: 10
Joined: Fri May 09, 2008 12:01 am

Re: MonkeySqueeze Development V2

Postby Gingernut63 » Fri Oct 07, 2011 4:35 pm

Hi Stephan

The current beta release here has been superceded by the official release, MonkeySqueeze V2.0.0.

I can replicate your issue. :-? Yes you are correct, password protection of LMS will stop MonkeySqueeze from communicating with LMS even when the password has been entered. I've tried a few different settings in the security section of LMS but none have worked. Will add this to the list of future fixes/additions. See first post on this topic.

At this stage if you wish to interface MediaMonkey with the Squeezebox system you will have to disable the password protection. :(

Thank you for the feedback
Gingernut63
MonkeySqueeze – Squeezing music into your life!
https://twitter.com/#!/MonkeySqueeze1
MonkeySqueeze Support: viewtopic.php?f=2&t=59515
MonkeySqueeze Development: viewtopic.php?f=19&t=59907
MediaMonkey user since 2005
Gingernut63
 
Posts: 188
Joined: Thu Jul 14, 2011 4:13 am

Re: MonkeySqueeze Development V2.1.0

Postby Gingernut63 » Sun Oct 30, 2011 8:35 pm

Latest Beta release V2.1.0.111031

The current version of the script is optimised for MediaMonkey 4 and above. It will run on MediaMonkey 3 but the options page will not display correctly.

Release improvements:
1. Power toggle for primary Squeezebox device when MonkeySqueeze is enabled. When MonkeySqueeze is enabled, the primary Squeezebox device will power on, and on/off at startup/shutdown. When MonkeySqueeze is disabled, primary Squeezebox device will power off. Does not work if SqueezePlay is the primary device. Thanks to Katteman

2. Bug fix: On seek now works for FLAC files as well as mp3. Thanks to Katteman. Have not tested other file types at this stage. Please post your findings.

3. Bug fix: The music plays on LMS the first time play is pressed in MediaMonkey after re-enabling MonkeySqueeze (issue only on some installations). Thanks to Katteman

4. Bug fix: When MediaMonkey is started without a track in the "Now Playing" window, clicking the MonkeySqueeze enable/disable button no longer gives the error " Object Required 'SongValue' ". Thanks to Katteman

5. I have revised the options page again, including a setting for Power Toggle Enable with tooltip.

Known Issues:
1. Major: Lag or buffering between MediaMonkey and the Squeezebox system. Work ongoing with options being investigated. Always on the lookout for someone to assist with the issue. Katteman has started programming part of the code.

2. Minor: There is one issue which can occur when re-enabling the connection, music can play on LMS when the enable button is pressed, even if no music is playing in MediaMonkey. Press play in MediaMonkey and then stop.

To use this version:
Copy the script to Notepad and save as MonkeySqueeze.vbs to one one of the following locations:
C:\Program Files\MediaMonkey\Scripts\Auto or C:\Program Files (x86)\MediaMonkey\Scripts\Auto

If you use this script please report any issues on this forum. Feedback is required so we can implement changes before any official release.

Code: Select all
'%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
'
' MonkeySqueeze V2.1.0.111031Beta
'
' ORIGINAL AUTHOR: Todd Nemeth/revel
' DATE STARTED: 26.09.2007
'
' ADDITIONAL AUTHORS: Baz, Big_Berny, Peke, trixmoto, debacle, mccstumble, Gingernut63, booblers, Katteman
' UPDATE DATE: 31.10.2011
'
' COMMENT:
'  - You will also need Logitech Media Server (Squeezebox Server) installed and running
'  - Optional: Install and run SqueezePlay or SoftSqueeze
'  - After installation the settings page for this script is located at Tools > Options > MonkeySqueeze
'
'%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Option Explicit
Public TimeLag
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Dim onMonkeySqueezeIcon
Dim offMonkeySqueezeIcon

'**************************************************************
Sub OnStartup
  Dim ind, Mnu
  Dim UI : Set UI = SDB.UI

  onMonkeySqueezeIcon = SDB.RegisterIcon("Scripts\Auto\sbon.ico", 0)
  If onMonkeySqueezeIcon < 0 Then
    onMonkeySqueezeIcon = 74 'unlocked icon if it doesn't exist
  End If

  offMonkeySqueezeIcon = SDB.RegisterIcon("Scripts\Auto\sboff.ico", 0)
  If offMonkeySqueezeIcon < 0 Then
    offMonkeySqueezeIcon = 75 'locked icon if it doesn't exist
  End If

  Set Mnu = UI.AddMenuItem( UI.Menu_TbStandard, 0, 0)
  Mnu.Caption = "MonkeySqueeze"
  Mnu.UseScript = Script.ScriptPath
  Mnu.OnClickFunc = "SyncToggle"
  Mnu.IconIndex = onMonkeySqueezeIcon
  Mnu.Hint = "Enable/Disable MonkeySqueeze"

  Set SDB.Objects("MonkeySqueezeIcon") = Mnu  'save a reference to it so we can change the icon later.

  If SDB.IniFile.BoolValue("MonkeySqueeze","SyncToggle") = True Then
    Call registerEvents
    Mnu.IconIndex = onMonkeySqueezeIcon
    If SDB.IniFile.BoolValue("PowerToggle","Enabled") = True Then slimRequest(formatCommand("""power"", ""1"""))
  Else
    Mnu.IconIndex = offMonkeySqueezeIcon
  End If

  ind = SDB.UI.AddOptionSheet("MonkeySqueeze",Script.ScriptPath,"InitSheet","SaveSheet",-2)

  'logme(slimRequest(formatCommand("""version"",""?""")))
End Sub

'**************************************************************
Sub InitSheet(Sheet)
  Dim Panel1, Panel2, Checkbox3, Panel3, Edit1, Panel4, Btn1, Edit2, Panel5, Edit3, Edit4, Edit5, Checkbox1, Checkbox2

  Set Panel1 = SDB.UI.NewGroupBox(Sheet)
  Panel1.Common.SetRect 10,10,600,50
  Panel1.Caption = "MonkeySqueeze v2.1.0.111031Beta"

  With SDB.UI.NewLabel(Panel1)
    .Common.SetRect 15,22,590,20
    .Caption = "This script allows MediaMonkey to play music on a Squeezebox system"
  End With

  Set Btn1 = SDB.UI.NewButton(Panel1)
  Btn1.Common.SetRect 520,15,65,25
  Btn1.Caption = "User Guide"
  Btn1.Common.Hint = "Click and then open MonkeySqueeze_UserGuide.pdf"
  Script.RegisterEvent Btn1, "OnClick", "UserGuide"

  Set Panel2 = SDB.UI.NewGroupBox(Sheet)
  Panel2.Common.SetRect 10,70,600,110
  Panel2.Caption = "General Settings"

  With SDB.UI.NewLabel(Panel2)
    .Common.SetRect 15,20,590,20
    .Caption = "Enable/Disable MonkeySqueeze on the toolbar below the main menu"
  End With
 
  With SDB.UI.NewLabel(Panel2)
    .Common.SetRect 15,40,590,20
    .Caption = "Power Toggle Option for Squeezebox Hardware Device:"
  End With
 
  Set CheckBox3 = SDB.UI.NewCheckBox(Panel2)
  CheckBox3.Common.SetRect 60,60,260,20
  CheckBox3.Checked = SDB.IniFile.BoolValue("PowerToggle","Enabled")
  CheckBox3.Common.ControlName = "EnablePT"
  CheckBox3.Common.Hint = SDB.Localize("When MonkeySqueeze is enabled, the primary Squeezebox device will power on, and on/off at startup/shutdown. When MonkeySqueeze is disabled, primary Squeezebox device will power off. Does not work if SqueezePlay is the primary device.")
  CheckBox3.Caption = SDB.Localize("Enable Power Toggle")
 
  Set Panel3 = SDB.UI.NewGroupBox(Sheet)
  Panel3.Common.SetRect 10,190,600,110
  Panel3.Caption = "Logitech Media Server IP Address and HTTP Port"

  With SDB.UI.NewLabel(Panel3)
    .Multiline = True
    .Common.SetRect 15,20,570,50
    .Caption = "Open the LMS (Squeezebox Server) Web Control page > Settings > Information tab and find the Server IP Address, e.g. 192.168.0.102 and enter below. The default HTTP Port number is 9000. See user guide if you wish to change it."
  End With

  With SDB.UI.NewLabel(Panel3)
    .Common.SetRect 15,59,70,20
    .Caption = "IP Address:"
  End With

  Set Edit1 = SDB.UI.NewEdit(Panel3)
  Edit1.Common.ControlName = "SqueezeBoxIP"
  Edit1.Common.SetRect 75,55,95,25
  Edit1.Text = SDB.IniFile.StringValue("SqueezeBox","IP")
  If Edit1.Text = "" Then
    Edit1.Text = "XXX.XXX.XXX.XXX"
    SDB.IniFile.StringValue("SqueezeBox","IP") = "XXX.XXX.XXX.XXX"
  End If
  Edit1.Common.Hint = "Copy and paste the LMS IP Address here"

  With SDB.UI.NewLabel(Panel3)
    .Common.SetRect 215,59,70,20
    .Caption = "HTTP Port No:"
  End With

  Set Edit2 = SDB.UI.NewEdit(Panel3)
  Edit2.Common.ControlName = "SqueezeBoxPort"
  Edit2.Common.SetRect 287,55,40,25
  Edit2.Text = SDB.IniFile.StringValue("SqueezeBox","Port")
  If Edit2.Text = "" Then
    Edit2.Text = "9000"
    SDB.IniFile.StringValue("SqueezeBox","Port") = "9000"
  End If
  Edit2.Common.Hint = "HTTP port default is 9000. View the port number in LMS: Web Control page > Settings > Information tab. It can be changed, see user guide for more details"

  With SDB.UI.NewLabel(Panel3)
    .Common.SetRect 15,85,570,20
    .Caption = "Press OK and restart the music for the changes to take effect."
  End With

  Set Panel4 = SDB.UI.NewGroupBox(Sheet)
  Panel4.Common.SetRect 10,310,600,110
  Panel4.Caption = "Primary Squeezebox Device - MAC Address"

  With SDB.UI.NewLabel(Panel4)
    .Multiline = True
    .Common.SetRect 15,20,570,60
    .Caption = "The MAC address of the device (Touch, SqueezePlay, etc...) you wish to connect to. Open the LMS Web Control page > Settings page > Information tab and find the device. Enter the MAC address, e.g. z1:6d:4g:40:1f:32"
  End With

  With SDB.UI.NewLabel(Panel4)
    .Common.SetRect 15,59,70,20
    .Caption = "Device MAC Address:"
  End With

  Set Edit3 = SDB.UI.NewEdit(Panel4)
  Edit3.Common.ControlName = "SqueezeBoxMAC"
  Edit3.Common.SetRect 122,55,110,25
  Edit3.Text = SDB.IniFile.StringValue("SqueezeBox","MAC")
  If Edit3.Text = "" Then
    Edit3.Text = "xx:xx:xx:xx:xx:xx"
    SDB.IniFile.StringValue("SqueezeBox","MAC") = "xx:xx:xx:xx:xx:xx"
  End If
  Edit3.Common.Hint = "Copy and paste the MAC address here. Use lowercase text for maximum compatibility"

  With SDB.UI.NewLabel(Panel4)
    .Common.SetRect 15,85,570,20
    .Caption = "Press OK and restart the music for the changes to take effect."
  End With

  Set Panel5 = SDB.UI.NewGroupBox(Sheet)
  Panel5.Common.SetRect 10,430,600,135
  Panel5.Caption = "Logitech Media Server on a Linux NAS"

  With SDB.UI.NewLabel(Panel5)
    .Multiline = True
    .Common.SetRect 15,20,570,60
    .Caption = "MonkeySqueeze communicates with LMS installed on a NAS however changes must be made to the format of the main music folder address. e.g. X:\Music to /media/Music"
  End With

  Set CheckBox1 = SDB.UI.NewCheckBox(Panel5)
  CheckBox1.Common.SetRect 60,53,260,20
  CheckBox1.Checked = SDB.IniFile.BoolValue("NAS","Enabled")
  CheckBox1.Common.ControlName = "EnableNAS"
  CheckBox1.Common.Hint = SDB.Localize("Select if using LMS on a Linux NAS device this includes Synology units. See user guide for more details")
  CheckBox1.Caption = SDB.Localize("Enable")
  Script.RegisterEvent CheckBox1.Common, "OnClick", "NASClick"

  Set CheckBox2 = SDB.UI.NewCheckBox(Panel5)
  CheckBox2.Common.SetRect 310,53,260,20
  CheckBox2.Checked = SDB.IniFile.BoolValue("Synology","Enabled")
  CheckBox2.Common.ControlName = "EnableSynology"
  CheckBox2.Common.Hint = SDB.Localize("Select if the NAS is made by Synology or if communications with LMS don't work")
  CheckBox2.Caption = SDB.Localize("Synology NAS")

  With SDB.UI.NewLabel(Panel5)
    .Common.SetRect 15,84,70,20
    .Caption = "MediaMonkey Music Folder:"
  End With

  Set Edit4 = SDB.UI.NewEdit(Panel5)
  Edit4.Common.ControlName = "MediaMonkeyMF"
  Edit4.Common.SetRect 150,80,160,25
  Edit4.Text = SDB.IniFile.StringValue("MediaMonkey","MF")
  If Edit4.Text = "" Then
    Edit4.Text = "X:\____\____"
    SDB.IniFile.StringValue("MediaMonkey","MF") = "X:\_____\_____"
  End If
  Edit4.Common.Hint = "Copy from MediaMonkey > File > Add/Rescan Folders or the Path column in the Track Browser section"

  With SDB.UI.NewLabel(Panel5)
    .Common.SetRect 315,84,40,20
    .Caption = "LMS Music Folder:"
  End With

  Set Edit5 = SDB.UI.NewEdit(Panel5)
  Edit5.Common.ControlName = "SqueezeboxMF"
  Edit5.Common.SetRect 405,80,180,25
  Edit5.Text = SDB.IniFile.StringValue("Squeezebox","MF")
  If Edit5.Text = "" Then
    Edit5.Text = "/_____/_____"
    SDB.IniFile.StringValue("SqueezeBox","MF") = "/_____/_____"
  End If
  Edit5.Common.Hint = "Copy and Paste from: LMS Web Page > Settings > Basic Settings tab > Music Folder"

  With SDB.UI.NewLabel(Panel5)
    .Common.SetRect 15,110,570,20
    .Caption = "Press OK and restart the music for the changes to take effect."
  End With

  CheckBox2.Common.Enabled = CheckBox1.Checked
  Edit4.Common.Enabled = CheckBox1.Checked
  Edit5.Common.Enabled = CheckBox1.Checked

End Sub
'**************************************************************
Sub NASClick(ChB)
  Dim ChB2, Edt4, Edt5

  Set ChB2 = ChB.Common.TopParent.Common.ChildControl("EnableSynology")
  Set Edt4 = ChB.Common.TopParent.Common.ChildControl("MediaMonkeyMF")
  Set Edt5 = ChB.Common.TopParent.Common.ChildControl("SqueezeboxMF")
  ChB2.Common.Enabled = ChB.Checked
  Edt4.Common.Enabled = ChB.Checked
  Edt5.Common.Enabled = ChB.Checked
End Sub
'**************************************************************
Sub SaveSheet(Sheet)
  SDB.IniFile.BoolValue("PowerToggle","Enabled") = Sheet.Common.ChildControl( "EnablePT").Checked
  SDB.IniFile.StringValue("SqueezeBox","IP") = Sheet.Common.ChildControl("SqueezeBoxIP").Text
  SDB.IniFile.StringValue("SqueezeBox","Port") = Sheet.Common.ChildControl("SqueezeBoxPort").Text
  SDB.IniFile.StringValue("SqueezeBox","MAC") = Sheet.Common.ChildControl("SqueezeBoxMAC").Text
  SDB.IniFile.BoolValue("NAS","Enabled") = Sheet.Common.ChildControl( "EnableNAS").Checked
  SDB.IniFile.BoolValue("Synology","Enabled") = Sheet.Common.ChildControl( "EnableSynology").Checked
  SDB.IniFile.StringValue("MediaMonkey","MF") = Sheet.Common.ChildControl("MediaMonkeyMF").Text
  SDB.IniFile.StringValue("Squeezebox","MF") = Sheet.Common.ChildControl("SqueezeboxMF").Text
End Sub
'**************************************************************
Sub UserGuide
  On Error Resume Next
  Dim OF, FolderToOpen

  Set OF = CreateObject("Shell.Application")
  FolderToOpen = sdb.ScriptsPath & "Auto\"
  OF.Explore FolderToOpen
  Set OF = Nothing
End Sub
'**************************************************************
Function SqueezeBoxMode
  Dim strRetVal

  On Error Resume Next
  SqueezeBoxMode = ""
  strRetVal = slimRequest(formatCommand("""mode"", ""?"""))
  If InStrRev(strRetVal, "play") > 0 Then
    SqueezeBoxMode = "play"
  ElseIf InStrRev(strRetVal, "stop") > 0 Then
    SqueezeBoxMode = "stop"
  ElseIf InStrRev(strRetVal, "pause") > 0 Then
    SqueezeBoxMode = "pause"
  End If
End Function
'**************************************************************
Sub Event_OnPlay
  Dim strRetVal, TrackPath

  TrackPath = CheckPath(SDB.Player.CurrentSong)
  If Not (SqueezeBoxMode = "play") Then
    strRetVal = slimRequest(formatCommand("""playlist"", ""play"", """ + perlEscape(TrackPath) + """"))
    'logme(strRetVal)
  Else
    strRetVal = slimRequest(formatCommand("""playlist"", ""add"", """ + perlEscape(TrackPath) + """"))
    strRetVal = slimRequest(formatCommand("""playlist"", ""index"", ""+1"""))
    'logme(strRetVal)
  End If
End Sub
'**************************************************************
Function SyncToggle( itm )
  Dim TrackPath, Mnu

  If SDB.IniFile.BoolValue("MonkeySqueeze","SyncToggle") = False Then
    SDB.IniFile.BoolValue("MonkeySqueeze","SyncToggle") = True
    itm.IconIndex = SDB.RegisterIcon("Scripts\Auto\sbon.ico", 0)
    Call registerEvents
    If SDB.IniFile.BoolValue("PowerToggle","Enabled") = True Then slimRequest(formatCommand("""power"", ""1"""))
    If Not (SDB.Player.CurrentSong is nothing) Then
      TrackPath = CheckPath(SDB.Player.CurrentSong)
      slimRequest(formatCommand("""playlist"", ""play"", """ + perlEscape(TrackPath) + """"))
      slimRequest(formatCommand("""time"", """ + CStr(SDB.Player.PlaybackTime*0.001) + """"))      'added 1 second to try to make up for net and lookup lag
    End If
  Else
    SDB.IniFile.BoolValue("MonkeySqueeze","SyncToggle") = False
    itm.IconIndex = SDB.RegisterIcon("Scripts\Auto\sboff.ico", 0)
    Call unregisterEvents
    slimRequest(formatCommand("""stop"""))
    If SDB.IniFile.BoolValue("PowerToggle","Enabled") = True Then slimRequest(formatCommand("""power"", ""0"""))
  End If
End Function
'**************************************************************
Sub Event_OnTrackEnd
  Dim strRetVal, idx, tim, dur

  'logme(SqueezeBoxMode)
  If SqueezeBoxMode = "play" Then
    strRetVal = slimRequest(formatCommand("""time"", ""?"""))
    idx = InStrRev(strRetVal, "_time"":") + 7
    tim = Eval(Mid(strRetVal, idx, Len(strRetVal) - idx - 1))
    strRetVal = slimRequest(formatCommand("""duration"", ""?"""))
    idx = InStrRev(strRetVal, "_duration"":""") + 12
    dur = Eval(Mid(strRetVal, idx, Len(strRetVal)- idx - 2))
    TimeLag = dur-tim
    'logme("End of track reached with time lag: " & Cstr(TimeLag))
  End If
End Sub
'**************************************************************
Function CheckPath(SongValue)
  If Left(SongValue.Path,1) = "?" Then
    If SongValue.Cached Then
      CheckPath = SongValue.CachedPath
    Else
      CheckPath = SongValue.Path
    End If
  Else
    CheckPath = SongValue.Path
  End If
  If SDB.IniFile.BoolValue("NAS","Enabled") = True Then
    If SDB.IniFile.BoolValue("Synology","Enabled") = True Then CheckPath = Replace(CheckPath,"\","/")
    CheckPath = Replace(CheckPath,SDB.IniFile.StringValue("MediaMonkey","MF"),SDB.IniFile.StringValue("SqueezeBox","MF"))
  End If
End Function
'**************************************************************
Sub Event_OnStop
  slimRequest(formatCommand("""stop"""))
End Sub
'**************************************************************
Sub Event_OnShutdown
  On Error Resume Next
  slimRequest(formatCommand("""stop""")) 
  If SDB.IniFile.BoolValue("PowerToggle","Enabled") = True Then slimRequest(formatCommand("""power"", ""0"""))
End Sub
'**************************************************************
Sub Event_OnPause
  If SDB.Player.IsPaused Then
    slimRequest(formatCommand("""pause"""))
  Else
    slimRequest(formatCommand("""play"""))
  End If
End Sub
'**************************************************************
Sub Event_OnSeek
  Dim TrackPath
 
  If SqueezeBoxMode = "stop" Then
    TrackPath = CheckPath(SDB.Player.CurrentSong)
    slimRequest(formatCommand("""playlist"", ""play"", """ + perlEscape(TrackPath) + """"))
  End If
  slimRequest(formatCommand("""time"", """ + CStr(SDB.Player.PlaybackTime*0.001) + """"))
End Sub
'**************************************************************
Function slimRequest(params)
  'slimRequest accepts pre-formatted parameter string, returns string of the response'
  'logme "  >> slimRequest: Begin with " + params
  Dim url, prog, objHTTP, str
  Dim cnt : cnt = 0
 
  url = "http://" + SDB.IniFile.StringValue("SqueezeBox","IP") + ":" + SDB.IniFile.StringValue("SqueezeBox","Port") + "/jsonrpc.js"
  'Set prog = SDB.Objects("LoadXMLBar")
  Set prog = SDB.Progress
  Set objHTTP = CreateObject("Microsoft.XMLHTTP")
  Call objHTTP.open("POST", url, True)
  objHTTP.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
  objHTTP.setRequestHeader "X-Requested-With", "XMLHttpRequest"
  objHTTP.setRequestHeader "User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.112 Safari/535.1"
  objHTTP.send(params)

  While (objHTTP.readyState < 4) And (cnt < 300)
    Call SDB.Tools.Sleep(100)
    SDB.ProcessMessages
    cnt = cnt+1
    If prog.Terminate Then
      cnt = 300
    End If
  Wend
 
  If objHTTP.readyState < 4 Then
    Set slimRequest = Nothing
  Else
    str = objHTTP.responseText
    slimRequest = str
  End If
End Function
'*************************************************************
'This is is a JSON RPC call - We're directly calling functions in the Slim::Request module in Perl. See here:
'http://svn.slimdevices.com/repos/slim/7.5/trunk/server/Slim/Control/Request.pm
'the addDispatch section tells you how to use the commands and what the RPC module is looking for in terms of formatting
Function formatCommand(str1)
  Dim str2
 
  str2 = "{""id"":1,""method"":""slim.request"",""params"":[""" + SDB.IniFile.StringValue("SqueezeBox","MAC") + """,[" + str1 + "]]}"
  formatCommand = str2
End Function
'*************************************************************
'borrowed from a teknojunky - if you want the popups add them to this and then just call logme
Sub logme(msg)
  Dim fso, logf
 
  On Error Resume Next
  Set fso = CreateObject("Scripting.FileSystemObject")
  Set logf = fso.OpenTextFile(Script.ScriptPath&".log",ForAppending,True)
  logf.WriteLine Now() & ": " & msg
  Set fso = Nothing
  Set logf = Nothing
End Sub
'*************************************************************
'Perl is taking the JSON strings directly into variables - "\" is a special character in perl to escape the following string
'wherever we have a "\" we need it to be "\\" in anything that goes to Perl (ie: anything that goes to Squeezebox)
Function perlEscape(str1)
  str1 = Replace(str1, "\", "\\")
  perlEscape = str1
End Function
'*************************************************************
Sub registerEvents
  Call Script.RegisterEvent(SDB,"OnPlay","Event_OnPlay")
  Call Script.RegisterEvent(SDB,"OnPause","Event_OnPause")
  Call Script.RegisterEvent(SDB,"OnStop","Event_OnStop")
  Call Script.RegisterEvent(SDB,"OnSeek","Event_OnSeek")
  Call Script.RegisterEvent(SDB,"OnTrackEnd","Event_OnTrackEnd")
  Call Script.RegisterEvent(SDB,"OnShutdown","Event_OnShutdown")
End Sub
'*************************************************************
Sub unregisterEvents
  Script.UnregisterEvents SDB
End Sub
'*************************************************************
'These are what the full JSON strings look like that need to be sent to slimRequest()
'formatRequest() fills in the first part and all you have to do is pick the RPC commands from http://svn.slimdevices.com/repos/slim/7.5/trunk/server/Slim/Control/Request.pm

'Note: there are cleaner ways of doing this - but this is quick and dirty. It just means that you have to use a lot of """ and etc in vbscript.
'This entire script is much easier to write in jscript but I don't know jscript at all so, shrug.

'{"id":1,"method":"slim.request","params":["00:04:20:17:06:xx",["status","-",1,"tags:cgABbehldiqtyrSuoKLN"]]}
'{"id":1,"method":"slim.request","params":["00:04:20:17:06:xx",["status","-",1,"tags:uB"]]}
'{"id":1,"method":"slim.request","params":["00:04:20:17:06:xx",["playlist","index",28]]}
'{"id":1,"method":"slim.request","params":["00:04:20:17:06:xx",["pause"]]}
'{"id":1,"method":"slim.request","params":["00:04:20:17:06:xx",[""playlist"", ""play"", ""D:\\MP3\\filename.mp3""]]}


'You can do ANYTHING you can do from the web interface via this RPC engine because you are directly calling the methods in Perl
'so you could add whole playlists and etc see the docs. Sky's the limit.
MonkeySqueeze – Squeezing music into your life!
https://twitter.com/#!/MonkeySqueeze1
MonkeySqueeze Support: viewtopic.php?f=2&t=59515
MonkeySqueeze Development: viewtopic.php?f=19&t=59907
MediaMonkey user since 2005
Gingernut63
 
Posts: 188
Joined: Thu Jul 14, 2011 4:13 am

Re: MonkeySqueeze Development V2.1.0

Postby Gingernut63 » Fri Nov 04, 2011 3:50 am

I have promised to post a beta where Katteman has an improvement concerning the lag issue. Well I'm going to hold off a little while longer as he has been beavering away and made further advancements, so please be patient.

By the way, I do know of at least two people who have downloaded betas and tried them out. Are there any more? Would love to know.

Cheers
Gingernut63
MonkeySqueeze – Squeezing music into your life!
https://twitter.com/#!/MonkeySqueeze1
MonkeySqueeze Support: viewtopic.php?f=2&t=59515
MonkeySqueeze Development: viewtopic.php?f=19&t=59907
MediaMonkey user since 2005
Gingernut63
 
Posts: 188
Joined: Thu Jul 14, 2011 4:13 am

Re: MonkeySqueeze Development V2.1.0

Postby Gingernut63 » Sat Nov 12, 2011 4:26 pm

Latest Alpha release V2.1.0.111109

The current version of the script is optimised for MediaMonkey 4 and above. It will run on MediaMonkey 3 but the options page will not display correctly.

This Alpha release has known issues with playlist sync. Yes that is right, Katteman has playlist sync working between MM and LMS! :D. It's not perfect but I decided to release it to obtain feedback on the direction that MonkeySqueeze is taking and on playlist sync itself. Katteman is currently working on rectifying issues in the code. If you haven't used an Alpha or Beta just follow the instructions below, it's easy.

Release improvements:
Playlist sync!! Thanks to Katteman

Instructions:
• Disable MS and with no tracks playing add songs to MM now playing window. When finished, press enable and the tracks will load into LMS. Can take some time with a large playlist (minutes)
• Or with no tracks playing add songs to MM now playing window. Tracks will start to load to LMS (not the preferred method)
• You will notice the progress bar flashing indicating tracks are loading. When the progress bar is not flashing and not highlighted then play can pressed
• Adding individual tracks with MM stopped, works. Try loading tracks while playing and see what happens (this works for Katteman but not for me)
• You can change track position while playing music
Don’t use shuffle. If you wish to shuffle tracks use randomize in MM and then enable MS to load tracks

Known Issues:
1. Major: Lag or buffering between MediaMonkey and the Squeezebox system. Katteman has written code with further changes to come.

2. Minor: There is one issue which can occur when re-enabling the connection, music can play on LMS when the enable button is pressed, even if no music is playing in MediaMonkey. Press play in MediaMonkey and then stop.

To use this version:
Copy the script to Notepad and save as MonkeySqueeze.vbs to one one of the following locations:
C:\Program Files\MediaMonkey\Scripts\Auto or C:\Program Files (x86)\MediaMonkey\Scripts\Auto

If you use this script please report any issues on this forum. Feedback is required so we can implement changes before any official release.

Code: Select all
'%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
'
' MonkeySqueeze V2.1.0.111109Alpha
'
' ORIGINAL AUTHOR: Todd Nemeth/revel
' DATE STARTED: 26.09.2007
'
' ADDITIONAL AUTHORS: Baz, Big_Berny, Peke, trixmoto, debacle, mccstumble, Gingernut63, booblers, Katteman
' UPDATE DATE: 09.11.2011
'
' COMMENT:
'  - You will also need Logitech Media Server (Squeezebox Server) installed and running
'  - Optional: Install and run SqueezePlay or SoftSqueeze
'  - After installation the options page for this script is located at Tools > Options > Player > MonkeySqueeze
'
'%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Option Explicit
Public EndOfTrack, NumOfTracks, Paths()
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Dim onMonkeySqueezeIcon
Dim offMonkeySqueezeIcon

'**************************************************************
Sub OnStartup
  Dim ind, Mnu
  Dim UI : Set UI = SDB.UI

  onMonkeySqueezeIcon = SDB.RegisterIcon("Scripts\Auto\sbon.ico", 0)
  If onMonkeySqueezeIcon < 0 Then
    onMonkeySqueezeIcon = 74 'unlocked icon if it doesn't exist
  End If

  offMonkeySqueezeIcon = SDB.RegisterIcon("Scripts\Auto\sboff.ico", 0)
  If offMonkeySqueezeIcon < 0 Then
    offMonkeySqueezeIcon = 75 'locked icon if it doesn't exist
  End If

  Set Mnu = UI.AddMenuItem( UI.Menu_TbStandard, 0, 0)
  Mnu.Caption = "MonkeySqueeze"
  Mnu.UseScript = Script.ScriptPath
  Mnu.OnClickFunc = "SyncToggle"
  Mnu.IconIndex = onMonkeySqueezeIcon
  Mnu.Hint = "Enable/Disable MonkeySqueeze"

  Set SDB.Objects("MonkeySqueezeIcon") = Mnu  'save a reference to it so we can change the icon later.

  If SDB.IniFile.BoolValue("MonkeySqueeze","SyncToggle") = True Then
    Call registerEvents
    Mnu.IconIndex = onMonkeySqueezeIcon
    If SDB.IniFile.BoolValue("PowerToggle","Enabled") = True Then slimRequest(formatCommand("""power"", ""1"""))
    Call FillPlaylist
  Else
    Mnu.IconIndex = offMonkeySqueezeIcon
  End If

  ind = SDB.UI.AddOptionSheet("MonkeySqueeze",Script.ScriptPath,"InitSheet","SaveSheet",-2)

  'logme(slimRequest(formatCommand("""version"",""?""")))
End Sub

'**************************************************************
Sub InitSheet(Sheet)
  Dim Panel1, Panel2, Checkbox3, Panel3, Edit1, Panel4, Btn1, Edit2, Panel5, Edit3, Edit4, Edit5, Checkbox1, Checkbox2

  Set Panel1 = SDB.UI.NewGroupBox(Sheet)
  Panel1.Common.SetRect 10,10,450,50
  Panel1.Caption = "MonkeySqueeze v2.1.0.111109Alpha"

  With SDB.UI.NewLabel(Panel1)
    .Common.SetRect 15,22,590,20
    .Caption = "This script allows MediaMonkey to play music on a Squeezebox system"
  End With

  Set Btn1 = SDB.UI.NewButton(Panel1)
  Btn1.Common.SetRect 370,15,65,25
  Btn1.Caption = "User Guide"
  Btn1.Common.Hint = "Click and then open MonkeySqueeze_UserGuide.pdf"
  Script.RegisterEvent Btn1, "OnClick", "UserGuide"

  Set Panel2 = SDB.UI.NewGroupBox(Sheet)
  Panel2.Common.SetRect 10,70,450,50
  Panel2.Caption = "General Settings"

  Set CheckBox3 = SDB.UI.NewCheckBox(Panel2)
  CheckBox3.Common.SetRect 15,20,150,20
  CheckBox3.Checked = SDB.IniFile.BoolValue("PowerToggle","Enabled")
  CheckBox3.Common.ControlName = "EnablePT"
  CheckBox3.Common.Hint = SDB.Localize("When selected if MonkeySqueeze is enabled, the primary Squeezebox device will power on, and on/off at startup/shutdown. When MonkeySqueeze is disabled, primary Squeezebox device will power off. Does not work if SqueezePlay is the primary device.")
  CheckBox3.Caption = SDB.Localize("Enable Power Toggle")

  Set Panel3 = SDB.UI.NewGroupBox(Sheet)
  Panel3.Common.SetRect 10,130,450,125
  Panel3.Caption = "Logitech Media Server IP Address and HTTP Port"

  With SDB.UI.NewLabel(Panel3)
    .Multiline = True
    .Common.SetRect 15,20,420,50
    .Caption = "Open the LMS (Squeezebox Server) Web Control page > Settings > Information tab and find the Server IP Address, e.g. 192.168.0.102 and enter below. The default HTTP Port number is 9000. See user guide if you wish to change it."
  End With

  With SDB.UI.NewLabel(Panel3)
    .Common.SetRect 15,74,70,20
    .Caption = "IP Address:"
  End With

  Set Edit1 = SDB.UI.NewEdit(Panel3)
  Edit1.Common.ControlName = "SqueezeBoxIP"
  Edit1.Common.SetRect 75,70,95,25
  Edit1.Text = SDB.IniFile.StringValue("SqueezeBox","IP")
  If Edit1.Text = "" Then
    Edit1.Text = "XXX.XXX.XXX.XXX"
    SDB.IniFile.StringValue("SqueezeBox","IP") = "XXX.XXX.XXX.XXX"
  End If
  Edit1.Common.Hint = "Copy and paste the LMS IP Address here"

  With SDB.UI.NewLabel(Panel3)
    .Common.SetRect 215,74,70,20
    .Caption = "HTTP Port No:"
  End With

  Set Edit2 = SDB.UI.NewEdit(Panel3)
  Edit2.Common.ControlName = "SqueezeBoxPort"
  Edit2.Common.SetRect 287,70,40,25
  Edit2.Text = SDB.IniFile.StringValue("SqueezeBox","Port")
  If Edit2.Text = "" Then
    Edit2.Text = "9000"
    SDB.IniFile.StringValue("SqueezeBox","Port") = "9000"
  End If
  Edit2.Common.Hint = "HTTP port default is 9000. View the port number in LMS: Web Control page > Settings > Information tab. It can be changed, see user guide for more details"

  With SDB.UI.NewLabel(Panel3)
    .Common.SetRect 15,100,450,20
    .Caption = "Press OK and restart the music for the changes to take effect."
  End With

  Set Panel4 = SDB.UI.NewGroupBox(Sheet)
  Panel4.Common.SetRect 10,265,450,125
  Panel4.Caption = "Primary Squeezebox Device - MAC Address"

  With SDB.UI.NewLabel(Panel4)
    .Multiline = True
    .Common.SetRect 15,20,420,60
    .Caption = "The MAC address of the device (Touch, SqueezePlay, etc...) you wish to connect to. Open the LMS Web Control page > Settings page > Information tab and find the device. Enter the MAC address, e.g. z1:6d:4g:40:1f:32"
  End With

  With SDB.UI.NewLabel(Panel4)
    .Common.SetRect 15,74,70,20
    .Caption = "Device MAC Address:"
  End With

  Set Edit3 = SDB.UI.NewEdit(Panel4)
  Edit3.Common.ControlName = "SqueezeBoxMAC"
  Edit3.Common.SetRect 122,70,110,25
  Edit3.Text = SDB.IniFile.StringValue("SqueezeBox","MAC")
  If Edit3.Text = "" Then
    Edit3.Text = "xx:xx:xx:xx:xx:xx"
    SDB.IniFile.StringValue("SqueezeBox","MAC") = "xx:xx:xx:xx:xx:xx"
  End If
  Edit3.Common.Hint = "Copy and paste the MAC address here. Use lowercase text for maximum compatibility"

  With SDB.UI.NewLabel(Panel4)
    .Common.SetRect 15,100,420,20
    .Caption = "Press OK and restart the music for the changes to take effect."
  End With

  Set Panel5 = SDB.UI.NewGroupBox(Sheet)
  Panel5.Common.SetRect 10,400,450,165
  Panel5.Caption = "Logitech Media Server on a Linux NAS"

  With SDB.UI.NewLabel(Panel5)
    .Multiline = True
    .Common.SetRect 15,20,420,60
    .Caption = "MonkeySqueeze communicates with LMS installed on a NAS however changes must be made to the format of the main music folder address. e.g. X:\Music to /media/Music"
  End With

  Set CheckBox1 = SDB.UI.NewCheckBox(Panel5)
  CheckBox1.Common.SetRect 60,53,260,20
  CheckBox1.Checked = SDB.IniFile.BoolValue("NAS","Enabled")
  CheckBox1.Common.ControlName = "EnableNAS"
  CheckBox1.Common.Hint = SDB.Localize("Select if using LMS on a Linux NAS device this includes Synology units. See user guide for more details")
  CheckBox1.Caption = SDB.Localize("Enable")
  Script.RegisterEvent CheckBox1.Common, "OnClick", "NASClick"

  Set CheckBox2 = SDB.UI.NewCheckBox(Panel5)
  CheckBox2.Common.SetRect 260,53,260,20
  CheckBox2.Checked = SDB.IniFile.BoolValue("Synology","Enabled")
  CheckBox2.Common.ControlName = "EnableSynology"
  CheckBox2.Common.Hint = SDB.Localize("Select if the NAS is made by Synology or if communications with LMS don't work")
  CheckBox2.Caption = SDB.Localize("Synology NAS")

  With SDB.UI.NewLabel(Panel5)
    .Common.SetRect 15,84,70,20
    .Caption = "MediaMonkey Music Folder:"
  End With

  Set Edit4 = SDB.UI.NewEdit(Panel5)
  Edit4.Common.ControlName = "MediaMonkeyMF"
  Edit4.Common.SetRect 148,80,200,25
  Edit4.Text = SDB.IniFile.StringValue("MediaMonkey","MF")
  If Edit4.Text = "" Then
    Edit4.Text = "X:\____\____"
    SDB.IniFile.StringValue("MediaMonkey","MF") = "X:\_____\_____"
  End If
  Edit4.Common.Hint = "Copy from MediaMonkey > File > Add/Rescan Folders or the Path column in the Track Browser section"

  With SDB.UI.NewLabel(Panel5)
    .Common.SetRect 15,114,70,20
    .Caption = "Logitech Media Server Music Folder:"
  End With

  Set Edit5 = SDB.UI.NewEdit(Panel5)
  Edit5.Common.ControlName = "SqueezeboxMF"
  Edit5.Common.SetRect 190,110,200,25
  Edit5.Text = SDB.IniFile.StringValue("Squeezebox","MF")
  If Edit5.Text = "" Then
    Edit5.Text = "/_____/_____"
    SDB.IniFile.StringValue("SqueezeBox","MF") = "/_____/_____"
  End If
  Edit5.Common.Hint = "Copy and Paste from: LMS Web Page > Settings > Basic Settings tab > Music Folder"

  With SDB.UI.NewLabel(Panel5)
    .Common.SetRect 15,140,420,20
    .Caption = "Press OK and restart the music for the changes to take effect."
  End With

  CheckBox2.Common.Enabled = CheckBox1.Checked
  Edit4.Common.Enabled = CheckBox1.Checked
  Edit5.Common.Enabled = CheckBox1.Checked

End Sub
'**************************************************************
Sub NASClick(ChB)
  Dim ChB2, Edt4, Edt5

  Set ChB2 = ChB.Common.TopParent.Common.ChildControl("EnableSynology")
  Set Edt4 = ChB.Common.TopParent.Common.ChildControl("MediaMonkeyMF")
  Set Edt5 = ChB.Common.TopParent.Common.ChildControl("SqueezeboxMF")
  ChB2.Common.Enabled = ChB.Checked
  Edt4.Common.Enabled = ChB.Checked
  Edt5.Common.Enabled = ChB.Checked
End Sub
'**************************************************************
Sub SaveSheet(Sheet)
  SDB.IniFile.BoolValue("PowerToggle","Enabled") = Sheet.Common.ChildControl( "EnablePT").Checked
  SDB.IniFile.StringValue("SqueezeBox","IP") = Sheet.Common.ChildControl("SqueezeBoxIP").Text
  SDB.IniFile.StringValue("SqueezeBox","Port") = Sheet.Common.ChildControl("SqueezeBoxPort").Text
  SDB.IniFile.StringValue("SqueezeBox","MAC") = Sheet.Common.ChildControl("SqueezeBoxMAC").Text
  SDB.IniFile.BoolValue("NAS","Enabled") = Sheet.Common.ChildControl( "EnableNAS").Checked
  SDB.IniFile.BoolValue("Synology","Enabled") = Sheet.Common.ChildControl( "EnableSynology").Checked
  SDB.IniFile.StringValue("MediaMonkey","MF") = Sheet.Common.ChildControl("MediaMonkeyMF").Text
  SDB.IniFile.StringValue("Squeezebox","MF") = Sheet.Common.ChildControl("SqueezeboxMF").Text
End Sub
'**************************************************************
Sub UserGuide
  On Error Resume Next
  Dim OF, FolderToOpen

  Set OF = CreateObject("Shell.Application")
  FolderToOpen = sdb.ScriptsPath & "Auto\"
  OF.Explore FolderToOpen
  Set OF = Nothing
End Sub
'**************************************************************
Function SqueezeBoxMode
  Dim strRetVal

  On Error Resume Next
  SqueezeBoxMode = ""
  strRetVal = slimRequest(formatCommand("""mode"", ""?"""))
  If InStrRev(strRetVal, "play") > 0 Then
    SqueezeBoxMode = "play"
  ElseIf InStrRev(strRetVal, "stop") > 0 Then
    SqueezeBoxMode = "stop"
  ElseIf InStrRev(strRetVal, "pause") > 0 Then
    SqueezeBoxMode = "pause"
  End If
End Function
'**************************************************************
Sub Event_OnPlay
  Dim strRetVal, Idx

  If (SqueezeBoxMode = "play") And (EndOfTrack = True) Then
    '*** normal playlist continuation
    EndOfTrack = False
  Else
    '*** SqueezeBox is not playing or new track out of order
    Idx = SDB.Player.CurrentSongIndex
    slimRequest(formatCommand("""playlist"", ""index"", """ + Cstr(Idx) + """"))
  End If
End Sub
'**************************************************************
Function SyncToggle( itm )
  Dim TrackPath, Mnu

  If SDB.IniFile.BoolValue("MonkeySqueeze","SyncToggle") = False Then
    SDB.IniFile.BoolValue("MonkeySqueeze","SyncToggle") = True
    itm.IconIndex = SDB.RegisterIcon("Scripts\Auto\sbon.ico", 0)
    Call registerEvents
    If SDB.IniFile.BoolValue("PowerToggle","Enabled") = True Then slimRequest(formatCommand("""power"", ""1"""))
    FillPlaylist
  Else
    SDB.IniFile.BoolValue("MonkeySqueeze","SyncToggle") = False
    itm.IconIndex = SDB.RegisterIcon("Scripts\Auto\sboff.ico", 0)
    Call unregisterEvents
    slimRequest(formatCommand("""stop"""))
    If SDB.IniFile.BoolValue("PowerToggle","Enabled") = True Then slimRequest(formatCommand("""power"", ""0"""))
  End If
End Function
'**************************************************************
Sub Event_OnTrackEnd
  Dim strRetVal, idx, tim, dur

  '*** see if current track ended, then playing is not interrupted
  EndOfTrack = True
End Sub
'**************************************************************
Function CheckPath(SongValue)
  If Left(SongValue.Path,1) = "?" Then
    If SongValue.Cached Then
      CheckPath = SongValue.CachedPath
    Else
      CheckPath = SongValue.Path
    End If
  Else
    CheckPath = SongValue.Path
  End If
  If SDB.IniFile.BoolValue("NAS","Enabled") = True Then
    If SDB.IniFile.BoolValue("Synology","Enabled") = True Then CheckPath = Replace(CheckPath,"\","/")
    CheckPath = Replace(CheckPath,SDB.IniFile.StringValue("MediaMonkey","MF"),SDB.IniFile.StringValue("SqueezeBox","MF"))
  End If
End Function
'**************************************************************
Sub Event_OnStop
  slimRequest(formatCommand("""stop"""))
End Sub
'**************************************************************
Sub Event_OnShutdown
  On Error Resume Next
  slimRequest(formatCommand("""stop"""))
  If SDB.IniFile.BoolValue("PowerToggle","Enabled") = True Then slimRequest(formatCommand("""power"", ""0"""))
End Sub
'**************************************************************
Sub Event_OnPause

  If SDB.Player.IsPaused Then
    slimRequest(formatCommand("""pause"""))
  Else
    slimRequest(formatCommand("""play"""))
  End If
End Sub
'**************************************************************
Sub Event_OnSeek
  Dim TrackPath

  If SqueezeBoxMode = "stop" Then
    TrackPath = CheckPath(SDB.Player.CurrentSong)
    slimRequest(formatCommand("""playlist"", ""play"", """ + perlEscape(TrackPath) + """"))
  End If
  slimRequest(formatCommand("""time"", """ + CStr(SDB.Player.PlaybackTime*0.001) + """"))
End Sub
'**************************************************************
Function slimRequest(params)
  'slimRequest accepts pre-formatted parameter string, returns string of the response'
  'logme "  >> slimRequest: Begin with " + params
  Dim url, prog, objHTTP, str
  Dim cnt : cnt = 0

  url = "http://" + SDB.IniFile.StringValue("SqueezeBox","IP") + ":" + SDB.IniFile.StringValue("SqueezeBox","Port") + "/jsonrpc.js"
  'Set prog = SDB.Objects("LoadXMLBar")
  Set prog = SDB.Progress
  Set objHTTP = CreateObject("Microsoft.XMLHTTP")
  Call objHTTP.open("POST", url, True)
  objHTTP.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
  objHTTP.setRequestHeader "X-Requested-With", "XMLHttpRequest"
  objHTTP.setRequestHeader "User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.112 Safari/535.1"
  objHTTP.send(params)

  While (objHTTP.readyState < 4) And (cnt < 300)
    Call SDB.Tools.Sleep(100)
    SDB.ProcessMessages
    cnt = cnt+1
    If prog.Terminate Then
      cnt = 300
    End If
  Wend

  If objHTTP.readyState < 4 Then
    Set slimRequest = Nothing
  Else
    str = objHTTP.responseText
    slimRequest = str
  End If
End Function
'*************************************************************
'This is is a JSON RPC call - We're directly calling functions in the Slim::Request module in Perl. See here:
'http://svn.slimdevices.com/repos/slim/7.5/trunk/server/Slim/Control/Request.pm
'the addDispatch section tells you how to use the commands and what the RPC module is looking for in terms of formatting
Function formatCommand(str1)
  Dim str2

  str2 = "{""id"":1,""method"":""slim.request"",""params"":[""" + SDB.IniFile.StringValue("SqueezeBox","MAC") + """,[" + str1 + "]]}"
  formatCommand = str2
End Function
'*************************************************************
'borrowed from a teknojunky - if you want the popups add them to this and then just call logme
Sub logme(msg)
  Dim fso, logf

  On Error Resume Next
  Set fso = CreateObject("Scripting.FileSystemObject")
  Set logf = fso.OpenTextFile(Script.ScriptPath&".log",ForAppending,True)
  logf.WriteLine Now() & ": " & msg
  Set fso = Nothing
  Set logf = Nothing
End Sub
'*************************************************************
'Perl is taking the JSON strings directly into variables - "\" is a special character in perl to escape the following string
'wherever we have a "\" we need it to be "\\" in anything that goes to Perl (ie: anything that goes to Squeezebox)
Function perlEscape(str1)
  str1 = Replace(str1, "\", "\\")
  perlEscape = str1
End Function
'*************************************************************
Sub registerEvents
  Call Script.RegisterEvent(SDB,"OnPlay","Event_OnPlay")
  Call Script.RegisterEvent(SDB,"OnPause","Event_OnPause")
  Call Script.RegisterEvent(SDB,"OnStop","Event_OnStop")
  Call Script.RegisterEvent(SDB,"OnSeek","Event_OnSeek")
  Call Script.RegisterEvent(SDB,"OnTrackEnd","Event_OnTrackEnd")
  Call Script.RegisterEvent(SDB,"OnShutdown","Event_OnShutdown")
  Call Script.RegisterEvent(SDB,"OnNowPlayingModified","Event_OnNowPlayingModified")
End Sub
'*************************************************************
Sub Event_OnNowPlayingModified
  Dim MMcount

  MMcount = SDB.Player.CurrentPlayList.Count
  'logme("Now playing modified")
  'logme("Aantal MM tracks: " & Cstr(MMcount))
  'logme("Aantal SB tracks: " & Cstr(NumOfTracks))
  If SqueezeBoxMode = "stop" Then
    FillPlaylist
  ElseIf MMcount = 0 Then
    ResetPlaylist
  ElseIf MMcount < NumOfTracks Then
    TracksDeleted(MMcount)
  ElseIf MMcount > NumOfTracks Then
    TracksAdded(MMcount)
  Else
    TracksMoved
  End If
End Sub
'*************************************************************
Sub FillPlaylist
  '*** synchronize MM playlist with SB playlist
  Dim Song, TrackPath, Idx, tempStop, n

  '*** clear SB playlist and stop shuffle!!
  slimRequest(formatCommand("""playlist"", ""clear"""))
  slimRequest(formatCommand("""playlist"", ""shuffle"", ""0"""))
  '*** copy MM playlist - if any - to SB
  NumOfTracks = SDB.Player.CurrentPlayList.Count
  ReDim Paths(NumOfTracks)
  'logme("Number of tracks is " & Cstr(NumOfTracks))
  '*** if playlist is empty we are done
  If NumOfTracks > 0 Then
    tempStop = (SDB.Player.isPlaying = True) And (SDB.Player.PlayBackTime < 2000)
    If tempStop Then
      SDB.Player.pause
      slimRequest(formatCommand("""stop"""))
    End If
    For n=0 To NumOfTracks-1
      Set Song = SDB.Player.CurrentPlayList.Item(n)
      TrackPath = CheckPath(Song)
      Paths(n) = TrackPath
      slimRequest(formatCommand("""playlist"", ""add"", """ + perlEscape(TrackPath) + """"))
    Next
    '*** jump to current song
    Idx = SDB.Player.CurrentSongIndex
    'logme("Selected track is " & Cstr(Idx))
    slimRequest(formatCommand("""playlist"", ""index"", """ + Cstr(Idx) + """"))
    If tempStop Then
       '*** Start playback after filling playlist
      SDB.Player.pause
    ElseIf SDB.Player.isPlaying = True Then
       '*** Synchronize SB with current track
      slimRequest(formatCommand("""time"", """ + CStr(SDB.Player.PlaybackTime*0.001) + """"))
    Else
       '*** MediaMonkey is not playing
      slimRequest(formatCommand("""stop"""))
    End If
  End If
  EndOfTrack = False
End Sub
'**************************************************************
Sub ResetPlaylist

  SDB.Player.Stop
  slimRequest(formatCommand("""stop"""))
  slimRequest(formatCommand("""playlist"", ""clear"""))
  ReDim Paths(0)
  NumOfTracks = 0

End Sub
'**************************************************************
Sub TracksDeleted(MMcount)
  Dim n, m, Song, TrackPath

  n = 0
  While MMcount < NumOfTracks
    If n = MMcount Then
      TrackPath = "***"
    Else
      Set Song = SDB.Player.CurrentPlayList.Item(n)
      TrackPath = CheckPath(Song)
    End If
    If (TrackPath = Paths(n)) Then
      n = n+1
    Else
      NumOfTracks = NumOfTracks - 1
      For m = n To NumOfTracks - 1
        Paths(m) = Paths(m+1)
      Next
      slimRequest(formatCommand("""playlist"", ""delete"", """ + Cstr(n) + """"))
    End If
  Wend
End Sub
'*************************************************************
Sub TracksAdded(MMcount)
  Dim n, m, Song, TrackPath

  ReDim Preserve Paths(MMcount)  'expand array, preserve content
  n = 0
  While MMcount > NumOfTracks
    If n = MMcount Then
      TrackPath = "***"
    Else
      Set Song = SDB.Player.CurrentPlayList.Item(n)
      TrackPath = CheckPath(Song)
    End If
    If (TrackPath = Paths(n)) Then
      n = n + 1
    Else
      slimRequest(formatCommand("""playlist"", ""add"", """ + perlEscape(TrackPath) + """"))
      If n < NumOfTracks Then
        slimRequest(formatCommand("""playlist"", ""move"", """ + Cstr(NumOfTracks) + """, """ + Cstr(n) + """"))
        For m = NumOfTracks To n+1 Step -1
          Paths(m) = Paths(m-1)
        Next
      End If
      Paths(n) = TrackPath
      NumOfTracks = NumOfTracks + 1
    End If
  Wend
End Sub
'*************************************************************
Sub TracksMoved
  Dim n, m, i, Song, TrackPath, tempPath

  For n=0 To NumOfTracks-1
    Set Song = SDB.Player.CurrentPlayList.Item(n)
    TrackPath = CheckPath(Song)
    If TrackPath <> Paths(n) Then
      For m=n+1 To NumOfTracks-1
        If TrackPath = Paths(m) Then Exit For
      Next
      For i=m To n+1 Step -1
        Paths(i) = Paths(i-1)
      Next
      Paths(n) = TrackPath
      slimRequest(formatCommand("""playlist"", ""move"", """ + Cstr(m) + """, """ + Cstr(n) + """"))
    End If
  Next
End Sub
'*************************************************************
Sub unregisterEvents
  Script.UnregisterEvents SDB
End Sub
'*************************************************************
'These are what the full JSON strings look like that need to be sent to slimRequest()
'formatRequest() fills in the first part and all you have to do is pick the RPC commands from http://svn.slimdevices.com/repos/slim/7.5/trunk/server/Slim/Control/Request.pm

'Note: there are cleaner ways of doing this - but this is quick and dirty. It just means that you have to use a lot of """ and etc in vbscript.
'This entire script is much easier to write in jscript but I don't know jscript at all so, shrug.

'{"id":1,"method":"slim.request","params":["00:04:20:17:06:xx",["status","-",1,"tags:cgABbehldiqtyrSuoKLN"]]}
'{"id":1,"method":"slim.request","params":["00:04:20:17:06:xx",["status","-",1,"tags:uB"]]}
'{"id":1,"method":"slim.request","params":["00:04:20:17:06:xx",["playlist","index",28]]}
'{"id":1,"method":"slim.request","params":["00:04:20:17:06:xx",["pause"]]}
'{"id":1,"method":"slim.request","params":["00:04:20:17:06:xx",[""playlist"", ""play"", ""D:\\MP3\\filename.mp3""]]}


'You can do ANYTHING you can do from the web interface via this RPC engine because you are directly calling the methods in Perl
'so you could add whole playlists and etc see the docs. Sky's the limit.
MonkeySqueeze – Squeezing music into your life!
https://twitter.com/#!/MonkeySqueeze1
MonkeySqueeze Support: viewtopic.php?f=2&t=59515
MonkeySqueeze Development: viewtopic.php?f=19&t=59907
MediaMonkey user since 2005
Gingernut63
 
Posts: 188
Joined: Thu Jul 14, 2011 4:13 am

Re: MonkeySqueeze Development V2.1.0

Postby Gingernut63 » Wed Nov 16, 2011 1:31 am

Latest Beta release V2.1.0.111112

The current version of the script is optimised for MediaMonkey 4 and above. It will run on MediaMonkey 3 but the options page will not display correctly.

If you haven't used an Alpha or Beta just follow the instructions below, it's easy.

Release improvements:
- Fixed: adding tracks to a playing playlist
- Warning popups if shuffle, repeat and crossfade selected when syncing playlists
- Progress bar now indicates that a playlist sync is taking place

Instructions:
• Disable MS and with no tracks playing add songs to MM now playing window. When finished, press enable and the tracks will load into LMS. Can take some time with a large playlist (minutes)
• Or with no tracks playing add songs to MM now playing window. Tracks will start to load to LMS (not the preferred method)
• You will notice the progress bar flashing indicating tracks are loading. When the progress bar is not flashing and not highlighted then play can be pressed
• Tracks can be added to a playlist at any time
• You can change track position while playing music
• Don’t use shuffle. If you wish to shuffle tracks use randomize in MM and then enable MS to load tracks

Known Issues:
1. Major: Lag or buffering between MediaMonkey and the Squeezebox system. Katteman has written code with further changes to come.

2. Minor: There is one issue which can occur when re-enabling the connection, music can play on LMS when the enable button is pressed, even if no music is playing in MediaMonkey. Press play in MediaMonkey and then stop.

To use this version:
Copy the script to Notepad and save as MonkeySqueeze.vbs to one one of the following locations:
C:\Program Files\MediaMonkey\Scripts\Auto or C:\Program Files (x86)\MediaMonkey\Scripts\Auto

If you use this script please report any issues on this forum. Feedback is required so we can implement changes before any official release.

Code: Select all
'%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
'
' MonkeySqueeze V2.1.0.111112Beta
'
' ORIGINAL AUTHOR: Todd Nemeth/revel
' DATE STARTED: 26.09.2007
'
' ADDITIONAL AUTHORS: Baz, Big_Berny, Peke, trixmoto, debacle, mccstumble, Gingernut63, booblers, Katteman
' UPDATE DATE: 12.11.2011
'
' COMMENT:
'  - You will also need Logitech Media Server (Squeezebox Server) installed and running
'  - Optional: Install and run SqueezePlay or SoftSqueeze
'  - After installation the options page for this script is located at Tools > Options > MonkeySqueeze
'
'%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Option Explicit
Public EndOfTrack, LMScount, LMSpaths()
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Dim onMonkeySqueezeIcon
Dim offMonkeySqueezeIcon

'**************************************************************
Sub OnStartup
  Dim ind, Mnu
  Dim UI : Set UI = SDB.UI

  onMonkeySqueezeIcon = SDB.RegisterIcon("Scripts\Auto\sbon.ico", 0)
  If onMonkeySqueezeIcon < 0 Then
    onMonkeySqueezeIcon = 74 'unlocked icon if it doesn't exist
  End If

  offMonkeySqueezeIcon = SDB.RegisterIcon("Scripts\Auto\sboff.ico", 0)
  If offMonkeySqueezeIcon < 0 Then
    offMonkeySqueezeIcon = 75 'locked icon if it doesn't exist
  End If

  Set Mnu = UI.AddMenuItem( UI.Menu_TbStandard, 0, 0)
  Mnu.Caption = "MonkeySqueeze"
  Mnu.UseScript = Script.ScriptPath
  Mnu.OnClickFunc = "SyncToggle"
  Mnu.IconIndex = onMonkeySqueezeIcon
  Mnu.Hint = "Enable/Disable MonkeySqueeze"

  Set SDB.Objects("MonkeySqueezeIcon") = Mnu  'save a reference to it so we can change the icon later.

  If SDB.IniFile.BoolValue("MonkeySqueeze","SyncToggle") = True Then
    ShowPlayerSettings
    Call registerEvents
    Mnu.IconIndex = onMonkeySqueezeIcon
    If SDB.IniFile.BoolValue("PowerToggle","Enabled") Then slimRequest(formatCommand("""power"", ""1"""))
    ShowPlayerSettings
    FillPlaylist
  Else
    Mnu.IconIndex = offMonkeySqueezeIcon
  End If

  ind = SDB.UI.AddOptionSheet("MonkeySqueeze",Script.ScriptPath,"InitSheet","SaveSheet",-2)

  'logme(slimRequest(formatCommand("""version"",""?""")))
End Sub

'**************************************************************
Sub InitSheet(Sheet)
  Dim Panel1, Panel2, Checkbox3, Panel3, Edit1, Panel4, Btn1, Edit2, Panel5, Edit3, Edit4, Edit5, Checkbox1, Checkbox2

  Set Panel1 = SDB.UI.NewGroupBox(Sheet)
  Panel1.Common.SetRect 10,10,450,50
  Panel1.Caption = "MonkeySqueeze v2.1.0.111112Beta"

  With SDB.UI.NewLabel(Panel1)
    .Common.SetRect 15,22,590,20
    .Caption = "This script allows MediaMonkey to play music on a Squeezebox system"
  End With

  Set Btn1 = SDB.UI.NewButton(Panel1)
  Btn1.Common.SetRect 370,15,65,25
  Btn1.Caption = "User Guide"
  Btn1.Common.Hint = "Click and then open MonkeySqueeze_UserGuide.pdf"
  Script.RegisterEvent Btn1, "OnClick", "UserGuide"

  Set Panel2 = SDB.UI.NewGroupBox(Sheet)
  Panel2.Common.SetRect 10,70,450,50
  Panel2.Caption = "General Settings"

  Set CheckBox3 = SDB.UI.NewCheckBox(Panel2)
  CheckBox3.Common.SetRect 15,20,150,20
  CheckBox3.Checked = SDB.IniFile.BoolValue("PowerToggle","Enabled")
  CheckBox3.Common.ControlName = "EnablePT"
  CheckBox3.Common.Hint = SDB.Localize("When selected if MonkeySqueeze is enabled, the primary Squeezebox device will power on, and on/off at startup/shutdown. When MonkeySqueeze is disabled, primary Squeezebox device will power off. Does not work if SqueezePlay is the primary device.")
  CheckBox3.Caption = SDB.Localize("Enable Power Toggle")

  Set Panel3 = SDB.UI.NewGroupBox(Sheet)
  Panel3.Common.SetRect 10,130,450,125
  Panel3.Caption = "Logitech Media Server IP Address and HTTP Port"

  With SDB.UI.NewLabel(Panel3)
    .Multiline = True
    .Common.SetRect 15,20,420,50
    .Caption = "Open the LMS (Squeezebox Server) Web Control page > Settings > Information tab and find the Server IP Address, e.g. 192.168.0.102 and enter below. The default HTTP Port number is 9000. See user guide if you wish to change it."
  End With

  With SDB.UI.NewLabel(Panel3)
    .Common.SetRect 15,74,70,20
    .Caption = "IP Address:"
  End With

  Set Edit1 = SDB.UI.NewEdit(Panel3)
  Edit1.Common.ControlName = "SqueezeBoxIP"
  Edit1.Common.SetRect 75,70,95,25
  Edit1.Text = SDB.IniFile.StringValue("SqueezeBox","IP")
  If Edit1.Text = "" Then
    Edit1.Text = "XXX.XXX.XXX.XXX"
    SDB.IniFile.StringValue("SqueezeBox","IP") = "XXX.XXX.XXX.XXX"
  End If
  Edit1.Common.Hint = "Copy and paste the LMS IP Address here"

  With SDB.UI.NewLabel(Panel3)
    .Common.SetRect 215,74,70,20
    .Caption = "HTTP Port No:"
  End With

  Set Edit2 = SDB.UI.NewEdit(Panel3)
  Edit2.Common.ControlName = "SqueezeBoxPort"
  Edit2.Common.SetRect 287,70,40,25
  Edit2.Text = SDB.IniFile.StringValue("SqueezeBox","Port")
  If Edit2.Text = "" Then
    Edit2.Text = "9000"
    SDB.IniFile.StringValue("SqueezeBox","Port") = "9000"
  End If
  Edit2.Common.Hint = "HTTP port default is 9000. View the port number in LMS: Web Control page > Settings > Information tab. It can be changed, see user guide for more details"

  With SDB.UI.NewLabel(Panel3)
    .Common.SetRect 15,100,450,20
    .Caption = "Press OK and restart the music for the changes to take effect."
  End With

  Set Panel4 = SDB.UI.NewGroupBox(Sheet)
  Panel4.Common.SetRect 10,265,450,125
  Panel4.Caption = "Primary Squeezebox Device - MAC Address"

  With SDB.UI.NewLabel(Panel4)
    .Multiline = True
    .Common.SetRect 15,20,420,60
    .Caption = "The MAC address of the device (Touch, SqueezePlay, etc...) you wish to connect to. Open the LMS Web Control page > Settings page > Information tab and find the device. Enter the MAC address, e.g. z1:6d:4g:40:1f:32"
  End With

  With SDB.UI.NewLabel(Panel4)
    .Common.SetRect 15,74,70,20
    .Caption = "Device MAC Address:"
  End With

  Set Edit3 = SDB.UI.NewEdit(Panel4)
  Edit3.Common.ControlName = "SqueezeBoxMAC"
  Edit3.Common.SetRect 122,70,110,25
  Edit3.Text = SDB.IniFile.StringValue("SqueezeBox","MAC")
  If Edit3.Text = "" Then
    Edit3.Text = "xx:xx:xx:xx:xx:xx"
    SDB.IniFile.StringValue("SqueezeBox","MAC") = "xx:xx:xx:xx:xx:xx"
  End If
  Edit3.Common.Hint = "Copy and paste the MAC address here. Use lowercase text for maximum compatibility"

  With SDB.UI.NewLabel(Panel4)
    .Common.SetRect 15,100,420,20
    .Caption = "Press OK and restart the music for the changes to take effect."
  End With

  Set Panel5 = SDB.UI.NewGroupBox(Sheet)
  Panel5.Common.SetRect 10,400,450,165
  Panel5.Caption = "Logitech Media Server on a Linux NAS"

  With SDB.UI.NewLabel(Panel5)
    .Multiline = True
    .Common.SetRect 15,20,420,60
    .Caption = "MonkeySqueeze communicates with LMS installed on a NAS however changes must be made to the format of the main music folder address. e.g. X:\Music to /media/Music"
  End With

  Set CheckBox1 = SDB.UI.NewCheckBox(Panel5)
  CheckBox1.Common.SetRect 60,53,260,20
  CheckBox1.Checked = SDB.IniFile.BoolValue("NAS","Enabled")
  CheckBox1.Common.ControlName = "EnableNAS"
  CheckBox1.Common.Hint = SDB.Localize("Select if using LMS on a Linux NAS device this includes Synology units. See user guide for more details")
  CheckBox1.Caption = SDB.Localize("Enable")
  Script.RegisterEvent CheckBox1.Common, "OnClick", "NASClick"

  Set CheckBox2 = SDB.UI.NewCheckBox(Panel5)
  CheckBox2.Common.SetRect 260,53,260,20
  CheckBox2.Checked = SDB.IniFile.BoolValue("Synology","Enabled")
  CheckBox2.Common.ControlName = "EnableSynology"
  CheckBox2.Common.Hint = SDB.Localize("Select if the NAS is made by Synology or if communications with LMS don't work")
  CheckBox2.Caption = SDB.Localize("Synology NAS")

  With SDB.UI.NewLabel(Panel5)
    .Common.SetRect 15,84,70,20
    .Caption = "MediaMonkey Music Folder:"
  End With

  Set Edit4 = SDB.UI.NewEdit(Panel5)
  Edit4.Common.ControlName = "MediaMonkeyMF"
  Edit4.Common.SetRect 148,80,200,25
  Edit4.Text = SDB.IniFile.StringValue("MediaMonkey","MF")
  If Edit4.Text = "" Then
    Edit4.Text = "X:\____\____"
    SDB.IniFile.StringValue("MediaMonkey","MF") = "X:\_____\_____"
  End If
  Edit4.Common.Hint = "Copy from MediaMonkey > File > Add/Rescan Folders or the Path column in the Track Browser section"

  With SDB.UI.NewLabel(Panel5)
    .Common.SetRect 15,114,70,20
    .Caption = "Logitech Media Server Music Folder:"
  End With

  Set Edit5 = SDB.UI.NewEdit(Panel5)
  Edit5.Common.ControlName = "SqueezeboxMF"
  Edit5.Common.SetRect 190,110,200,25
  Edit5.Text = SDB.IniFile.StringValue("Squeezebox","MF")
  If Edit5.Text = "" Then
    Edit5.Text = "/_____/_____"
    SDB.IniFile.StringValue("SqueezeBox","MF") = "/_____/_____"
  End If
  Edit5.Common.Hint = "Copy and Paste from: LMS Web Page > Settings > Basic Settings tab > Music Folder"

  With SDB.UI.NewLabel(Panel5)
    .Common.SetRect 15,140,420,20
    .Caption = "Press OK and restart the music for the changes to take effect."
  End With

  CheckBox2.Common.Enabled = CheckBox1.Checked
  Edit4.Common.Enabled = CheckBox1.Checked
  Edit5.Common.Enabled = CheckBox1.Checked

End Sub
'**************************************************************
Sub NASClick(ChB)
  Dim ChB2, Edt4, Edt5

  Set ChB2 = ChB.Common.TopParent.Common.ChildControl("EnableSynology")
  Set Edt4 = ChB.Common.TopParent.Common.ChildControl("MediaMonkeyMF")
  Set Edt5 = ChB.Common.TopParent.Common.ChildControl("SqueezeboxMF")
  ChB2.Common.Enabled = ChB.Checked
  Edt4.Common.Enabled = ChB.Checked
  Edt5.Common.Enabled = ChB.Checked
End Sub
'**************************************************************
Sub SaveSheet(Sheet)
  SDB.IniFile.BoolValue("PowerToggle","Enabled") = Sheet.Common.ChildControl( "EnablePT").Checked
  SDB.IniFile.StringValue("SqueezeBox","IP") = Sheet.Common.ChildControl("SqueezeBoxIP").Text
  SDB.IniFile.StringValue("SqueezeBox","Port") = Sheet.Common.ChildControl("SqueezeBoxPort").Text
  SDB.IniFile.StringValue("SqueezeBox","MAC") = Sheet.Common.ChildControl("SqueezeBoxMAC").Text
  SDB.IniFile.BoolValue("NAS","Enabled") = Sheet.Common.ChildControl( "EnableNAS").Checked
  SDB.IniFile.BoolValue("Synology","Enabled") = Sheet.Common.ChildControl( "EnableSynology").Checked
  SDB.IniFile.StringValue("MediaMonkey","MF") = Sheet.Common.ChildControl("MediaMonkeyMF").Text
  SDB.IniFile.StringValue("Squeezebox","MF") = Sheet.Common.ChildControl("SqueezeboxMF").Text
End Sub
'**************************************************************
Sub UserGuide
  On Error Resume Next
  Dim OF, FolderToOpen

  Set OF = CreateObject("Shell.Application")
  FolderToOpen = sdb.ScriptsPath & "Auto\"
  OF.Explore FolderToOpen
  Set OF = Nothing
End Sub
'**************************************************************
Function SqueezeBoxMode
  Dim strRetVal

  On Error Resume Next
  SqueezeBoxMode = ""
  strRetVal = slimRequest(formatCommand("""mode"", ""?"""))
  If InStrRev(strRetVal, "play") > 0 Then
    SqueezeBoxMode = "play"
  ElseIf InStrRev(strRetVal, "stop") > 0 Then
    SqueezeBoxMode = "stop"
  ElseIf InStrRev(strRetVal, "pause") > 0 Then
    SqueezeBoxMode = "pause"
  End If
End Function
'**************************************************************
Sub ShowPlayerSettings
  Dim Plr, Warning, Res

  Warning = ""
  Set Plr = SDB.Player
  'If Plr.isAutoDJ    Then Warning = Warning & vbNewLine & "AutoDJ is on"
  If Plr.isCrossFade Then Warning = Warning & vbNewLine & "CrossFade is on"
  If Plr.isShuffle   Then Warning = Warning & vbNewLine & "Shuffle is on"
  'If Plr.isEqualizer Then Warning = Warning & vbNewLine & "Equalizer is on"
  If Plr.isRepeat    Then Warning = Warning & vbNewLine & "Repeat is on"
  If Warning <> "" Then
    Res = SDB.MessageBox("Selected player settings:" & vbNewLine & _
    Warning, mtWarning, Array(mbOk))
  End If
End Sub
'**************************************************************
Function SyncToggle( itm )

  If SDB.IniFile.BoolValue("MonkeySqueeze","SyncToggle") = False Then
    SDB.IniFile.BoolValue("MonkeySqueeze","SyncToggle") = True
    itm.IconIndex = SDB.RegisterIcon("Scripts\Auto\sbon.ico", 0)
    Call registerEvents
    If SDB.IniFile.BoolValue("PowerToggle","Enabled") Then slimRequest(formatCommand("""power"", ""1"""))
    ShowPlayerSettings
    FillPlaylist
  Else
    SDB.IniFile.BoolValue("MonkeySqueeze","SyncToggle") = False
    itm.IconIndex = SDB.RegisterIcon("Scripts\Auto\sboff.ico", 0)
    Call unregisterEvents
    slimRequest(formatCommand("""stop"""))
    If SDB.IniFile.BoolValue("PowerToggle","Enabled") Then slimRequest(formatCommand("""power"", ""0"""))
  End If
End Function
'**************************************************************
Sub Event_OnPlay
  Dim strRetVal, Idx

  If (SqueezeBoxMode = "play") And EndOfTrack Then
      '*** normal playlist continuation
      EndOfTrack = False
  Else
    '*** SqueezeBox is not playing or new track out of order
    Idx = SDB.Player.CurrentSongIndex
    slimRequest(formatCommand("""playlist"", ""index"", """ + Cstr(Idx) + """"))
  End If
End Sub
'**************************************************************
Sub Event_OnTrackEnd
  Dim strRetVal, idx, tim, dur

  '*** see if current track ended, then playing is not interrupted
  EndOfTrack = True
End Sub
'**************************************************************
Function CheckPath(SongValue)
  If Left(SongValue.Path,1) = "?" Then
    If SongValue.Cached Then
      CheckPath = SongValue.CachedPath
    Else
      CheckPath = SongValue.Path
    End If
  Else
    CheckPath = SongValue.Path
  End If
  If SDB.IniFile.BoolValue("NAS","Enabled") Then
    If SDB.IniFile.BoolValue("Synology","Enabled") Then CheckPath = Replace(CheckPath,"\","/")
    CheckPath = Replace(CheckPath,SDB.IniFile.StringValue("MediaMonkey","MF"),SDB.IniFile.StringValue("SqueezeBox","MF"))
  End If
End Function
'**************************************************************
Sub Event_OnStop
  slimRequest(formatCommand("""stop"""))
End Sub
'**************************************************************
Sub Event_OnShutdown
  On Error Resume Next
  slimRequest(formatCommand("""stop"""))
  If SDB.IniFile.BoolValue("PowerToggle","Enabled") Then slimRequest(formatCommand("""power"", ""0"""))
End Sub
'**************************************************************
Sub Event_OnPause

  If SDB.Player.IsPaused Then
    slimRequest(formatCommand("""pause"""))
  Else
    slimRequest(formatCommand("""play"""))
  End If
End Sub
'**************************************************************
Sub Event_OnSeek
  Dim SBmode, Song, TrackPath, LMStime

  SBmode = SqueezeBoxMode
  If SBmode = "stop" Then
     Set Song = SDB.Player.CurrentSong
    TrackPath = CheckPath(Song)
    slimRequest(formatCommand("""playlist"", ""play"", """ + perlEscape(TrackPath) + """"))
  End If
  LMStime = 0.001 * SDB.Player.PlaybackTime
  slimRequest(formatCommand("""time"", """ + CStr(LMStime) + """"))
End Sub
'**************************************************************
Function slimRequest(params)
  'slimRequest accepts pre-formatted parameter string, returns string of the response'
  'logme "  >> slimRequest: Begin with " + params
  Dim url, prog, objHTTP
  Dim cnt : cnt = 0

  url = "http://" + SDB.IniFile.StringValue("SqueezeBox","IP") + ":" + SDB.IniFile.StringValue("SqueezeBox","Port") + "/jsonrpc.js"
  'Set prog = SDB.Objects("LoadXMLBar")
  Set prog = SDB.Progress
  Set objHTTP = CreateObject("Microsoft.XMLHTTP")
  Call objHTTP.open("POST", url, True)
  objHTTP.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
  objHTTP.setRequestHeader "X-Requested-With", "XMLHttpRequest"
  objHTTP.setRequestHeader "User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.112 Safari/535.1"
  objHTTP.send(params)

  Do While (objHTTP.readyState < 4) And (cnt < 300)
    Call SDB.Tools.Sleep(100)
    SDB.ProcessMessages
    cnt = cnt+1
    If prog.Terminate Then
      cnt = 300
    End If
  Loop

  If objHTTP.readyState < 4 Then
    Set slimRequest = Nothing
  Else
    slimRequest = objHTTP.responseText
  End If
End Function
'*************************************************************
'This is is a JSON RPC call - We're directly calling functions in the Slim::Request module in Perl. See here:
'http://svn.slimdevices.com/repos/slim/7.5/trunk/server/Slim/Control/Request.pm
'the addDispatch section tells you how to use the commands and what the RPC module is looking for in terms of formatting
Function formatCommand(str1)
  formatCommand = "{""id"":1,""method"":""slim.request"",""params"":[""" + SDB.IniFile.StringValue("SqueezeBox","MAC") + """,[" + str1 + "]]}"
End Function
'*************************************************************
'borrowed from a teknojunky - if you want the popups add them to this and then just call logme
Sub logme(msg)
  Dim fso, logf

  On Error Resume Next
  Set fso = CreateObject("Scripting.FileSystemObject")
  Set logf = fso.OpenTextFile(Script.ScriptPath&".log",ForAppending,True)
  logf.WriteLine Now() & ": " & msg
  Set fso = Nothing
  Set logf = Nothing
End Sub
'*************************************************************
'Perl is taking the JSON strings directly into variables - "\" is a special character in perl to escape the following string
'wherever we have a "\" we need it to be "\\" in anything that goes to Perl (ie: anything that goes to Squeezebox)
Function perlEscape(str1)
  perlEscape = Replace(str1, "\", "\\")
End Function
'*************************************************************
Sub registerEvents
  Call Script.RegisterEvent(SDB,"OnPlay","Event_OnPlay")
  Call Script.RegisterEvent(SDB,"OnPause","Event_OnPause")
  Call Script.RegisterEvent(SDB,"OnStop","Event_OnStop")
  Call Script.RegisterEvent(SDB,"OnSeek","Event_OnSeek")
  Call Script.RegisterEvent(SDB,"OnTrackEnd","Event_OnTrackEnd")
  Call Script.RegisterEvent(SDB,"OnShutdown","Event_OnShutdown")
  Call Script.RegisterEvent(SDB,"OnNowPlayingModified","Event_OnNowPlayingModified")
End Sub
'*************************************************************
Sub Event_OnNowPlayingModified
  Dim MMcount

  MMcount = SDB.Player.CurrentPlayList.Count
  'logme("Now playing modified")
  'logme("Aantal MM tracks: " & Cstr(MMcount))
  'logme("Aantal LMS tracks: " & Cstr(LMScount))
  If SqueezeBoxMode = "stop" Then
    FillPlaylist
  ElseIf MMcount = 0 Then
     ResetPlaylist
  ElseIf MMcount < LMScount Then
    TracksDeleted(MMcount)
  ElseIf MMcount > LMScount Then
    TracksAdded(MMcount)
  Else
    TracksMoved
  End If
End Sub
'*************************************************************
Sub FillPlaylist
  '*** synchronize MM playlist with LMS playlist
  Dim tempStop, Idx

  '*** clear LMS playlist and stop shuffle!!
  slimRequest(formatCommand("""playlist"", ""clear"""))
  slimRequest(formatCommand("""playlist"", ""shuffle"", ""0"""))
  '*** copy MM playlist - if any - to LMS
  LMScount = SDB.Player.CurrentPlayList.Count
  ReDim LMSpaths(LMScount)
  '*** if playlist is empty we are done
  If LMScount > 0 Then
    tempStop = SDB.Player.isPlaying And (SDB.Player.PlayBackTime < 2000)
    If tempStop Then
      SDB.Player.pause
      slimRequest(formatCommand("""stop"""))
    End If
    SendPlaylist
    '*** jump to current song
    Idx = SDB.Player.CurrentSongIndex
    slimRequest(formatCommand("""playlist"", ""index"", """ + Cstr(Idx) + """"))
    If tempStop Then
       '*** Start playback after filling playlist
      SDB.Player.Pause
    ElseIf SDB.Player.isPlaying Then
       '*** Synchronize LMS with current track
      slimRequest(formatCommand("""time"", """ + CStr(SDB.Player.PlaybackTime*0.001) + """"))
      If SDB.Player.isPaused Then SDB.Player.Pause
    Else
       '*** MediaMonkey is not playing
      slimRequest(formatCommand("""stop"""))
    End If
  End If
  EndOfTrack = False
End Sub
'**************************************************************
Sub SendPlaylist
  Dim Progr, TrackPath, Song, n

  '*** show progress bar
  Set Progr = SDB.Progress
  'Progr.Text = SDB.Localize("MonkeySqueeze Sending Tracks to LMS...")
  Progr.Text = SDB.Localize("Playlist synchronizing with LMS...")
  Progr.MaxValue = LMScount
  '*** send playlist
  For n=0 To LMScount-1
    Set Song = SDB.Player.CurrentPlayList.Item(n)
    TrackPath = CheckPath(Song)
    LMSpaths(n) = TrackPath
    slimRequest(formatCommand("""playlist"", ""add"", """ + perlEscape(TrackPath) + """"))
    Progr.Value = n+1
  Next
End Sub
'**************************************************************
Sub ResetPlaylist

  SDB.Player.Stop
  slimRequest(formatCommand("""stop"""))
  slimRequest(formatCommand("""playlist"", ""clear"""))
  ReDim LMSpaths(0)
  LMScount = 0
End Sub
'**************************************************************
Sub TracksDeleted(MMcount)
  Dim n, m, Song, TrackPath

  'logme("Tracks deleted")
  n = 0
  Do While MMcount < LMScount
    If n = MMcount Then
      TrackPath = "***"
    Else
      Set Song = SDB.Player.CurrentPlayList.Item(n)
      TrackPath = CheckPath(Song)
    End If
    If (TrackPath = LMSpaths(n)) Then
      n = n+1
    Else
      LMScount = LMScount - 1
      For m = n To LMScount - 1
        LMSpaths(m) = LMSpaths(m+1)
      Next
      slimRequest(formatCommand("""playlist"", ""delete"", """ + Cstr(n) + """"))
    End If
  Loop
End Sub
'*************************************************************
Sub TracksAdded(MMcount)
  Dim n, m, Song, TrackPath

  'logme("Tracks added")
  ReDim Preserve LMSpaths(MMcount)  'expand array, preserve content
  Do
    For n = 0 to MMcount -1
      Set Song = SDB.Player.CurrentPlayList.Item(n)
      TrackPath = CheckPath(Song)
      If (TrackPath <> LMSpaths(n)) Then
        slimRequest(formatCommand("""playlist"", ""add"", """ + perlEscape(TrackPath) + """"))
        If n < LMScount Then
          slimRequest(formatCommand("""playlist"", ""move"", """ + Cstr(LMScount) + """, """ + Cstr(n) + """"))
          For m = LMScount To n+1 Step -1
            LMSpaths(m) = LMSpaths(m-1)
          Next
        End If
        LMSpaths(n) = TrackPath
        LMScount = LMScount + 1
      End If
    Next
  Loop While MMcount > LMScount
End Sub
'*************************************************************
Sub TracksMoved
  Dim n, m, i, Song, TrackPath, tempPath

  'logme("Tracks moved")
  For n=0 To LMScount-1
    Set Song = SDB.Player.CurrentPlayList.Item(n)
    TrackPath = CheckPath(Song)
    If TrackPath <> LMSpaths(n) Then
      For m=n+1 To LMScount-1
        If TrackPath = LMSpaths(m) Then Exit For
      Next
      For i=m To n+1 Step -1
        LMSpaths(i) = LMSpaths(i-1)
      Next
      LMSpaths(n) = TrackPath
      slimRequest(formatCommand("""playlist"", ""move"", """ + Cstr(m) + """, """ + Cstr(n) + """"))
    End If
  Next
End Sub
'*************************************************************
Sub unregisterEvents
  Script.UnregisterEvents SDB
End Sub
'*************************************************************
'These are what the full JSON strings look like that need to be sent to slimRequest()
'formatRequest() fills in the first part and all you have to do is pick the RPC commands from http://svn.slimdevices.com/repos/slim/7.5/trunk/server/Slim/Control/Request.pm

'Note: there are cleaner ways of doing this - but this is quick and dirty. It just means that you have to use a lot of """ and etc in vbscript.
'This entire script is much easier to write in jscript but I don't know jscript at all so, shrug.

'{"id":1,"method":"slim.request","params":["00:04:20:17:06:xx",["status","-",1,"tags:cgABbehldiqtyrSuoKLN"]]}
'{"id":1,"method":"slim.request","params":["00:04:20:17:06:xx",["status","-",1,"tags:uB"]]}
'{"id":1,"method":"slim.request","params":["00:04:20:17:06:xx",["playlist","index",28]]}
'{"id":1,"method":"slim.request","params":["00:04:20:17:06:xx",["pause"]]}
'{"id":1,"method":"slim.request","params":["00:04:20:17:06:xx",[""playlist"", ""play"", ""D:\\MP3\\filename.mp3""]]}


'You can do ANYTHING you can do from the web interface via this RPC engine because you are directly calling the methods in Perl
'so you could add whole playlists and etc see the docs. Sky's the limit.
MonkeySqueeze – Squeezing music into your life!
https://twitter.com/#!/MonkeySqueeze1
MonkeySqueeze Support: viewtopic.php?f=2&t=59515
MonkeySqueeze Development: viewtopic.php?f=19&t=59907
MediaMonkey user since 2005
Gingernut63
 
Posts: 188
Joined: Thu Jul 14, 2011 4:13 am

PreviousNext

Return to Addons developer forum

Who is online

Users browsing this forum: No registered users and 6 guests