Slimdevices Squeezebox / Squeezecenter Support (Plugin) or D

Any ideas about how to improve MediaMonkey? Let us know!

Moderator: Gurus

mccstumble
Posts: 44
Joined: Fri Jul 30, 2010 8:46 am

Re: Slimdevices Squeezebox / Squeezecenter Support (Plugin)

Post by mccstumble » Thu Jun 02, 2011 5:14 am

Hi All,

I hope this may be of help to some of you....

I have been using the script below (+ a few modifications to it obtained from the clever people on the forums) for a few years now. I have it as a text file in "C:\Program Files\MediaMonkey\Scripts\Auto" (ie where mediamonkey is installed).

If my memory serves me correctly the original developer got the script so far and then gave up in favour of other interests. Needless to say a few others picked up where he left off and what is pasted below works a treat for me.

I have Squeezebox server (currently Version: 7.5.4 - r32171) installed on my Vista laptop and it looks at my music collection on an attached Portable Hard Disk Drive. This was fine for simply playing music to my various Squeezeboxes and initially I thought it was great. But, as so many have commented Squeezebox Server is not ideal for Library Management and things like tagging files etc.

As a separate activity I have Mediamonkey looking at the same music collection on the Portable Hard Disk Drive and I use Mediamonkey to manage the collection. (ie one collection of music files which I think is one library?). Anyway - any changes I make via Mediamonkey (ie album art, titles etc) are committed to the individual files.

The problem was that Mediamonkey only played on the laptop and didn't "talk" to Squeezebox Server. This is where the script came in and resolved the problem

The script means that when Mediamonkey starts it "somehow" sends the currently playing song to Squeezebox Server and it turn to my Squeezeboxes. Even better is that when I am using Mediamonkey whatever I play or fast-forward, rewind, pause or stop is transferred to the Squeezebox Server.

I also have iPeng set up on my iPod Touch which is great as a controller for Squeezebox Server (and much better than using the original remote control that came with my Squeezebox Duet).

Also on my iPod Touch I use the Apple App "Remote" which can control Mediamonkey using Mellorware's "MonkeyTunes" (http://melloware.com/products/monkeytunes/). So this means I can Run Mediamonkey on my laptop but control it remotely using "Remote" via Monkeytunes and at the same time have it playing on my Squeezeboxes. If I want to then view related information such as Artist Biography etc I just switch to iPeng to get the info

So here is the script I have been using for a few years now. Just copy it in it's entirety and save it to the Mediamonkey AutoScripts folder. You will need to edit the IP Address of your Squeezebox Server. A bit of a pain is that if the IP changes later you need to locate the file and ammend it with the new IP address. Apart form that it runs like a dream. Not perfect but I mostly forget it is there.

To edit the IP address just look for and overtype the "X's" with your Squeezebox Server's IP Address. You will find this information on the "Settings Page" and "Information" tab of your Squeezebox Server under "Server IP Address"




Code: Select all

    '==========================================================================
    ' NAME: SqueezeBox Controller
    '
    ' ORIGINAL AUTHOR: Todd Nemeth /revel
    ' DATE STARTED: 26.09.2007
    '
    ' ADDITIONAL AUTHORS: Baz, Big_Berny, Peke, trixmoto
    ' UPDATE DATE: 28.02.2008
    '
    ' COMMENT:
    '- You need w3Sockets installed and registered from here:
    '  http://www.dimac.net/default3.asp?M=FreeDownloads/'Menu.asp&P=FreeDownloads/FreeDownloadsstart.asp
    '- You will also need SlimServer installed and running.'
    '==========================================================================

    Option Explicit
    Public SqueezeBoxSocket
    Public ManualTrackChange

    Sub OnStartup
      Dim ind
      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,"OnShutdown","Event_OnShutdown")
    '  Call Script.RegisterEvent(SDB,"OnTrackEnd","Event_OnTrackEnd")
    '  Call Script.RegisterEvent(SDB,"OnPlaybackEnd","Event_OnPlaybackEnd")
    '  Call Script.RegisterEvent(SDB,"OnIdle","Event_OnIdle")
      ind = SDB.UI.AddOptionSheet("SqueezeBox Controller",Script.ScriptPath,"InitSheet","SaveSheet",-2)
      InitSqueezeBox
      ManualTrackChange = True
      Call SDB.Player.Play
    End Sub

    Sub InitSheet( Sheet)
      Dim UI : Set UI = SDB.UI
      Dim LabelAbout : Set LabelAbout = UI.NewLabel(Sheet)
      LabelAbout.Multiline = True
      LabelAbout.Common.SetRect 5,5,470,40
      LabelAbout.Common.Anchors = 4
      LabelAbout.Caption = "This small script will add ability to Control SqueezeBox using MediaMonkey Playback Controls"

      Dim Label1 : Set Label1 = UI.NewLabel(Sheet)
      Label1.Autosize = True
      Label1.Common.SetRect 10,31,65,20
      Label1.Common.Anchors = 4
      Label1.Caption = SDB.Localize("SlimServer IP:")
      Label1.Common.Hint = "Local IP address where SlimServer is Installed (127.0.0.1, 192.168.1.10, ...)"

      Dim Edit1 : Set Edit1 = UI.NewEdit(Sheet)
      Edit1.Common.ControlName = "SqueezeBoxIP"
      Edit1.Common.SetRect 85,27,121,20
      Edit1.Text = SDB.IniFile.StringValue("SqueezeBox","IP")
      If Edit1.Text = "" Then
        Edit1.Text = "127.0.0.1"
        SDB.IniFile.StringValue("SqueezeBox","IP") = "127.0.0.1"
      End If
      Edit1.Common.Anchors = 1
      Edit1.Common.Hint = "Enter Local IP address where SlimServer is Installed (127.0.0.1, 192.168.1.10, ...)"

    End Sub

    Sub SaveSheet(Sheet)
      SDB.IniFile.StringValue("SqueezeBox","IP") = Sheet.Common.ChildControl("SqueezeBoxIP").Text
    End Sub

    Sub InitSqueezeBox
      On Error Resume Next
      Set SqueezeBoxSocket = CreateObject("Socket.TCP")
      SqueezeBoxSocket.DoTelnetEmulation = True
      SqueezeBoxSocket.TelnetEmulation = "TTY"
      SqueezeBoxSocket.Host = "XXX.XXX.X.XX:9090"
      SqueezeBoxSocket.Open
    End Sub

    Sub CloseSqueezeBox
      On Error Resume Next
      SqueezeBoxSocket.Close
    End Sub

    Sub SendSqueezeBoxCmd(strPlayerCmd)
      On Error Resume Next
      SqueezeBoxSocket.SendLine strPlayerCmd
      ' Call ReadSqueezeBoxLine
    End Sub

    Sub ReadSqueezeBoxLine
      On Error Resume Next
      Dim line
      line = SqueezeBoxSocket.GetLine
    End Sub

    Function SqueezeBoxMode
      On Error Resume Next
      SqueezeBoxMode = ""
    '  SqueezeBoxSocket.SendLine "mode ?"
    '  SqueezeBoxMode = SqueezeBoxSocket.GetLine
    End Function

    Function Max(a,b)
      If a > b Then
        Max = a
      Else
        Max = b
      End If
    End Function

    Sub Event_OnPlay
      Dim strRetVal, TrackPath
      TrackPath = Escape(CheckPath(SDB.Player.CurrentSong))
      TrackPath = Replace(TrackPath,"%5C","%2F")
      TrackPath = Replace(TrackPath,"#","%23")
      If ManualTrackChange = True Then
    '    MsgBox("Manual")
        Call SendSqueezeBoxCmd("stop")
    '    MsgBox( TrackPath )
        Call SendSqueezeBoxCmd("playlist play file%3A%2F%2F%2F" & TrackPath )
      Else
    '    MsgBox("Auto")
        Call SendSqueezeBoxCmd("playlist add file%3A%2F%2F%2F" & TrackPath )
        ManualTrackChange = True
      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
    End Function

    Sub Event_OnStop
      Call SendSqueezeBoxCmd("stop")
    End Sub

    Sub Event_OnShutdown
      On Error Resume Next
      Call SendSqueezeBoxCmd("stop")
      CloseSqueezeBox
    End Sub

    Sub Event_OnPause
      If SDB.Player.IsPaused Then
       Call SendSqueezeBoxCmd("pause FromMediaMonkeyOn")
      Else
       Call SendSqueezeBoxCmd("pause FromMediaMonkeyOff")
      End If
    End Sub

    Sub Event_OnSeek
      Dim strRetVal, TrackPath
      strRetVal = SqueezeBoxMode
      TrackPath = Escape(CheckPath(SDB.Player.CurrentSong))
      TrackPath = Replace(TrackPath,"%5C","%2F")
      If InStr(1,strRetval,"mode stop") > 0 Then
        Call SendSqueezeBoxCmd("playlist play file%3A%2F%2F%2F" & TrackPath )
      End If
      Call SendSqueezeBoxCmd("time " & SDB.Player.PlaybackTime*0.001 )
    End Sub

    Sub Event_OnTrackEnd
      MsgBox("Track End")
      ManualTrackChange = False
    End Sub

    Sub Event_OnPlaybackEnd
      MsgBox("Playback End")
      ManualTrackChange = False
    End Sub

    Sub Event_OnIdle
      MsgBox("Idle End")
      ManualTrackChange = False
    End Sub

    Function ShortFilePath(LongFilePath)
      Dim FSO : Set FSO = CreateObject( "Scripting.FileSystemObject" )
      ShortFilePath = FSO.GetFile(LongFilePath).ShortPath
    End Function

    Function CurrentSong
      CurrentSong = ShortFilePath( CheckPath(SDB.Player.CurrentSong) )
      CurrentSong = Escape( CurrentSong )
      CurrentSong = Replace(CurrentSong,"%5C","%2F")
    End Function
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/viewto ... =2&t=59515
On Demand Music: LastFM, Spotify via LMS

gpzbc
Posts: 1226
Joined: Sat Sep 13, 2008 12:02 am
Location: Colorado, USA

Re: Slimdevices Squeezebox / Squeezecenter Support (Plugin)

Post by gpzbc » Thu Jun 02, 2011 9:45 am

Cool! Thanks for posting this. I think it will come in handy.
--
The gpzbc

mccstumble
Posts: 44
Joined: Fri Jul 30, 2010 8:46 am

Re: Slimdevices Squeezebox / Squeezecenter Support (Plugin)

Post by mccstumble » Thu Jun 02, 2011 10:56 am

Hi GPZBC

You're welcome. Just seemd that after visiting this page a lot of people were still asking the same questions that were being asked ages ago. I thought since my MM and SBS has been working seamlessly for so long it might be useful to others.

Hope so..
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/viewto ... =2&t=59515
On Demand Music: LastFM, Spotify via LMS

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

Re: Slimdevices Squeezebox / Squeezecenter Support (Plugin)

Post by Peke » Thu Jun 02, 2011 5:41 pm

@mccstumble
Good Update, also you can speed script up in MM4 by using http://www.mediamonkey.com/wiki/index.p ... tShortPath to replace "Function ShortFilePath(LongFilePath)" and make script working in Non admin accounts.
Best regards,
Pavle
MediaMonkey Team lead QA/Tech Support guru
Admin of Free MediaMonkey addon Site HappyMonkeying
Image
Image
How to add SCREENSHOTS to forum

mccstumble
Posts: 44
Joined: Fri Jul 30, 2010 8:46 am

Re: Slimdevices Squeezebox / Squeezecenter Support (Plugin)

Post by mccstumble » Fri Jun 03, 2011 2:04 pm

@ Peke

Thanks for the info. I checked the link but not sure what to do with it (there doesnt seem to be code to copy?? and I can't write it)
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/viewto ... =2&t=59515
On Demand Music: LastFM, Spotify via LMS

Bluemax

Re: Slimdevices Squeezebox / Squeezecenter Support (Plugin)

Post by Bluemax » Sat Jun 11, 2011 3:20 pm

@mccstumble
Short question: how do I start this script ? I tried around with auto script and individual start through script.ini but I always get a script runtime error called "#13". I had a problem to install the w3 socket DLL on my desktop with windows VISTA. But I also tried it on my netbook with XP. No installation error but the same runtime #13 error. I must do something wrong to get the script started.

Using latest MM and Squeezeserver 7.54. Must be doing someting wrong initially ...

I am looking forward to use this kind of charming script ;-)

mccstumble
Posts: 44
Joined: Fri Jul 30, 2010 8:46 am

Re: Slimdevices Squeezebox / Squeezecenter Support (Plugin)

Post by mccstumble » Mon Jun 13, 2011 10:03 am

@Bluemax

If I understand you correctly the problem doesn't seem to be due to the w3 socket DLL?

I am not a programmer and I got the script off the forum years ago so I wouldn't know what the runtime error is - sorry!!.

I have the script located in the mediamonkey autoscript folder and it runs without a hitch as soon as MM starts.

Without wishing to be asking teh obvious - Have you made sure you are using the correct squeezeserver ip address?

Let me know if you get it working - it's a cool script and one I'm using right now

Anyone else on the forum who may be able to help Blumax with this??
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/viewto ... =2&t=59515
On Demand Music: LastFM, Spotify via LMS

Bluemax

Re: Slimdevices Squeezebox / Squeezecenter Support (Plugin)

Post by Bluemax » Sat Jun 25, 2011 11:47 am

@mccstumble
Thanks for your answer. I managed the "#13" error now - name of the script must be the same as the start "sub" routine inside the script. So I exchanged "sub OnStartup" with "sub SQ" and the error passed ...

... but it still is not working properly. When I run it now from scripts menu it starts but only plays the current song. No action towards my Squeezebox. If I understood it right you only need to write the IP address of the computer where squeezebox server is running. So I exchanged all the XXX.XXX.X.XX into my PCs IP address. But this was only one line in your script. Maybe I still did not catch it.

mccstumble
Posts: 44
Joined: Fri Jul 30, 2010 8:46 am

Re: Slimdevices Squeezebox / Squeezecenter Support (Plugin)

Post by mccstumble » Mon Jun 27, 2011 3:02 pm

@ Bluemax

Not sure if this is connected but when I run mediamonkey I usually Run As Administrator. Anyway once Mediamonkey is up and running I don't need to go near any of the scripts menus (in fact my squuezebox script doesn't even show on the Tools/Scrpts menu). Mediamonkey simply sends the information automatically to Squeezeserver. The script is running automatically in the background, so to speak?

I make sure squeezeserver is running and then I start mediamonkey. From that point mediamonkey will load and play the last song it was playing in it's last session and this will automatically be sent to squeezeserver. All other selections and actions will also be sent to squeezeserver (Stop, Fast Forward etc)

Are you sure you have placed the script in Media Monkey's "Auto Script" folder?? Because when I look in the Tools/Scripts Menu I don't see the script

Am I understanding you properly when you say yo are having to run the script form Tools/Sript Menu?

Let me know how you get on

Good luck
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/viewto ... =2&t=59515
On Demand Music: LastFM, Spotify via LMS

mccstumble
Posts: 44
Joined: Fri Jul 30, 2010 8:46 am

Re: Slimdevices Squeezebox / Squeezecenter Support (Plugin)

Post by mccstumble » Mon Jun 27, 2011 3:11 pm

@bluemax

just also notice you are using you'r computers ip address......

You need to use the Squeezebox Server IP address and you will find it on the Squeezebox Server "SETTINGS" page under the "INFORMATION" tab / Squeezebox Server Status / Server Ip Address

Hope this helps
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/viewto ... =2&t=59515
On Demand Music: LastFM, Spotify via LMS

gingernut

Re: Slimdevices Squeezebox / Squeezecenter Support (Plugin)

Post by gingernut » Thu Jul 14, 2011 4:49 am

G'day Mccstumble

Great posts. I'm have problems getting the script to work. could you please answer the following questions

What is the name of the script?
Is it a VBS file?

My issues are possibly related to the squeezebox server running on a NAS device, will continue to tinker.

Gingernut

mccstumble
Posts: 44
Joined: Fri Jul 30, 2010 8:46 am

Re: Slimdevices Squeezebox / Squeezecenter Support (Plugin)

Post by mccstumble » Thu Jul 14, 2011 12:41 pm

@Gingernut

I saved the script in mediamonkey autoscript folder

It is a VBS file and mine is simply named "SqueezeboxPlay"

It might be worth noting that my squeezebox server and Mediamonkey are both installed on my PC - not sure if your problems are down to the sever being on a NAS?

Hope this helps
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/viewto ... =2&t=59515
On Demand Music: LastFM, Spotify via LMS

gingernuts63

Re: Slimdevices Squeezebox / Squeezecenter Support (Plugin)

Post by gingernuts63 » Fri Jul 15, 2011 12:30 am

Thanks for the reply Mccstumble

Just grasping at straws. To avoid any further groping in the dark I'll install the PC version of Squeezebox Server and see if that works. Post a reply either way.

Ta
Gingernut

gingernuts63

Re: Slimdevices Squeezebox / Squeezecenter Support (Plugin)

Post by gingernuts63 » Fri Jul 15, 2011 7:02 pm

No luck

I've installed the latest PC version of Squeezebox server and disabled the version running on the Netgear ReadyNAS. W3sockets was installed and registered previously as suggested in the code. MediaMonkey runs and plays music, SqueezeServer does nothing, no errors, no popups, nothing. The coms between MM and SS appear not to be working.

Looks like I'm missing something and wouldn't mind betting its a simple fix.

Points to note:
1. The IP address for SqueezeBoxSocket.Host has been entered and checked via SqueezeServer advanced options/information
2. The vbs file is saved in auto scripts folder
3. MediaMonkey is run as administrator
4. OS - Win7 32 bit

SqueezeBox Server Control Panel - Information tab

Squeezebox Server Status
Version: 7.5.5 - r32671 @ Mon Jul 11 12:00:49 PDT 2011
Hostname: XXXX
IP: 192.168.0.106
HTTP Port: 9000
OS: Windows 7 - EN - cp1252
Platform: 586
Perl Version: 5.10.0 - MSWin32-x86-multi-thread
MySQL Version: 5.0.22-community-nt
Total Players Recognized: 1
Library Statistics
Total Tracks: XXX
Total Albums: XXX
Total Artists: XXX
Total Genres: XXX
Total Playing Time: XXXXX
Player Information
Information on all identified devices connected to Squeezebox Server
Squeezebox
Player Model: Squeezebox Boom
Firmware: 54
Player IP Address: 192.168.0.188
Player MAC Address: 00:04:20:1e:4a:e3
Wireless Signal Strength: 70%
Cache Folder
C:\ProgramData\Squeezebox\Cache
Preferences Folder
C:\ProgramData\Squeezebox\prefs
Plugin Folders
C:\PROGRA~1\SQUEEZ~1\server\Slim\Plugin, C:\ProgramData\Squeezebox\Cache\InstalledPlugins\Plugins, C:\PROGRA~1\SQUEEZ~1\server\Plugins
Squeezebox Server Log File
C:\ProgramData\Squeezebox\Logs\server.log
Scanner Log File
C:\ProgramData\Squeezebox\Logs\scanner.log

Gingernuts63

Re: Slimdevices Squeezebox / Squeezecenter Support (Plugin)

Post by Gingernuts63 » Fri Jul 15, 2011 9:57 pm

Update

Partial Success

If I play music in Squeezebox Server (SS) and play music in MediaMonkey (MM) with the script active the music playing section in SS clears but no music from MM displays or plays. If I the restart playing music in SS and play another track in MM the SS music playing area clears again but no MM music displays or plays. Disabling the script stops the preceding actions.

Obviously the script is trying send MM music to SS but something is amiss. Fast running out of ideas, would appreciate any input.

Gingernuts

Post Reply