Re: Slimdevices Squeezebox / Squeezecenter Support (Plugin) or D
Posted: Fri Feb 05, 2010 4:34 am
I would too!
The Music Manager for Serious Collectors
https://mediamonkey.com/forum/
Peke wrote:Shhhhh. I didn't told you this but MM 4.x will see uPnP servers (it even saw my WMP 12 Library). So you may not need to pay anything, but you need to wait.
Until MM4 is released for alpha testing, I imagine.kalowski wrote:Peke wrote:Shhhhh. I didn't told you this but MM 4.x will see uPnP servers (it even saw my WMP 12 Library). So you may not need to pay anything, but you need to wait.
Ooooh! How long?
danyal wrote:Mediamonkey is really great for a large collection of music which is exactly why I use it. But as of late I listen to most of my music via a squeezebox + home audio system. It would be great if I could play music via Mediamonkey and have it play on my squeezebox. I don't want it playing in both places or anything like that. I just want to be able to use MM to manage my media.
I don't think this would be too hard to implement. Basically each song in squeezecenter has a songId. If MM could scan the squeezecenter database and retrieve those songIds and store them in its own database for each song, all it would need to do is send the songId via CLI to squeezecenter when a user selects a song to play. The squeezecenter db could be re-scanned from time to time...
++++++++++++++!!!!!!!!!!!!!
I've just jumped into this topic among others on a search around as I contemplate getting a squeeze box to get all my music from PC to fat stereo, and what this might mean for my beloved MM. I'm no technical expert so I can't even contemplate clever scripts etc but having read round a few of the related topics are the following conclusions I have reached correct?Peke wrote:Shhhhh. I didn't told you this but MM 4.x will see uPnP servers (it even saw my WMP 12 Library). So you may not need to pay anything, but you need to wait.
As far as I can tell your conclusions 1+2 seem to be right. About MM4's UPnP support I am not really sure what this means. Ideally MM4 could act as UPnP server itself, and SC/SB could access that. But that seems unlikely ("MM 4.x will see uPnP servers"). If MM4 can see SC as UPnP server what does that really mean? It can play files from that server? Does not help with SB - we want to play on SB. It can update its library with the data from SC? Also does not help with SB - we need the other way around. And after all it still means maintaining two libraries with practically the same content. I am not thrilled about this.gid9000 wrote:I'm no technical expert so I can't even contemplate clever scripts etc but having read round a few of the related topics are the following conclusions I have reached correct?
My Roku Soundbridge can access PS3MediaServer, and I created a plugin for it. Can you check if that works for you? That way there is no need to synchronize SqueezeBox Server with MediaMonkey info.gid9000 wrote:I've just jumped into this topic among others on a search around as I contemplate getting a squeeze box to get all my music from PC to fat stereo, and what this might mean for my beloved MM. I'm no technical expert so I can't even contemplate clever scripts etc but having read round a few of the related topics are the following conclusions I have reached correct?Peke wrote:Shhhhh. I didn't told you this but MM 4.x will see uPnP servers (it even saw my WMP 12 Library). So you may not need to pay anything, but you need to wait.
1. At present SB Duet and MM basically don't talk to each other and you have to run two separate libraries if you want to continue with MM once you get a SB.
2. But it is possible, somehow, to get the SB library to sync with the MM once per day which is a small step in the right direction. Somehow...
3. But MM4, when it appears, is going to have some clever new thing in it that means it will be able to read the SB library. Or something. So I should wait.
Sorry if this makes me sound like a dull witted technofool, either stating the obvious or getting the wrong end of the stick, but I'm sure I'm not the only MM-committed but generally "light" computer user who would like to know the state of play on all this without having to read several threads, make notes and then cross reference them via some sort of mind map to get the full picture. I plan to be running one Windows blah media centre PC, one SB duet attached to the aforementioned fat stereo and Media Monkey.
Your patience and assistance in this is much appreciated.
gid9000
MediaMonkey Gold user and general MM evangelist to anyone who will listen
Code: Select all
' This script connects MediaMonkey to a SqueezeBox
' Place the script in the .../MediaMonkey/Scripts/Auto
' and restart MediaMonkey.
' Edit the file squeeze.ini to setup your installation.
Dim socket
Dim enableSqueeze
Dim previousEnableSqueeze
Dim squeezeCenterIp
Dim playerId
Dim playerName
Dim previousPlayerName
Dim mediaMonkeyPath1
Dim squeezeCenterPath1
Dim mediaMonkeyPath2
Dim squeezeCenterPath2
Dim settingsFile
Dim powerOffOnExit
Dim initialVolume
Sub OnStartup
initialVolume = SDB.Player.Volume
settingsFile = SDB.ScriptsPath & "\Auto\squeeze.ini"
SqueezeLoadOptions settingsFile
Script.RegisterEvent SDB, "OnPlay", "SqueezePlay"
Script.RegisterEvent SDB, "OnPause", "SqueezePause"
Script.RegisterEvent SDB, "OnShutdown", "SqueezeOnShutdown"
dlg = SDB.UI.AddOptionSheet ("SqueezeBox", Script.ScriptPath, "SqueezeInitOptions", "SqueezeSaveOptions", -2)
End Sub
Sub EnableDisableSqueeze
If previousEnableSqueeze Then
If enableSqueeze Then
' squeeze --> squeeze
Set socket = CreateObject("Socket.TCP")
socket.DoTelnetEmulation = True
socket.TelnetEmulation = "TTY"
socket.Host = squeezeCenterIp
socket.Open
If StrComp (playerName, previousPlayerName) <> 0 Then
SendCommand "power 0"
SDB.Player.Stop
SDB.Player.Play
End If
playerId = DeterminePlayerId (playerName)
SendCommand "power 1"
Else
' squeeze --> pc
SendCommand "power 0"
SDB.Player.Stop
SDB.Player.Volume = initialVolume
SDB.Player.Play
End If
Else
If enableSqueeze Then
' pc --> squeeze
initialVolume = SDB.Player.Volume
SDB.Player.Volume = 0.0
if SDB.Player.IsPlaying Then
SDB.Player.Stop
SDB.Player.Play
End If
Set socket = CreateObject("Socket.TCP")
socket.DoTelnetEmulation = True
socket.TelnetEmulation = "TTY"
socket.Host = squeezeCenterIp
socket.Open
playerId = DeterminePlayerId (playerName)
SendCommand "power 1"
Else
' pc --> pc
End If
End If
End Sub
Sub SendCommand (cmd)
' Send command
command = playerId + " " + cmd
command = Replace (command, "/", "%2F")
command = Replace (command, ",", "%2C")
command = Replace (command, "#", "%23")
command = Replace (command, "&", "%26")
'command = Replace (command, "ë", "%C3")
command = Trim (command)
socket.SendLine (command)
' Retrieve answer
response = socket.GetLine
response = Trim (response)
If StrComp (command, response) <> 0 Then
text = "Error sending command to SqueezeBox" & vbCrLf & vbCrLf &_
"Send: " & command & " (" & Len(command) & ")" & vbCrLf & vbCrLf &_
"Received: " & response & " (" & Len(response) & ")"
MsgBox text, vbOKOnly + vbCritical, "Squeeze Error"
End If
End Sub
Sub SendCommandParam (cmd, param)
param = Replace (param, " ", "%20")
param = Replace (param, "\", "/")
SendCommand (cmd + " " + param)
End Sub
Function DeterminePlayerId (name)
id = ""
socket.SendLine "player count ?"
response = Split(Trim (socket.GetLine), " ")
For i = 1 to response(2)
socket.SendLine "player name " & i-1 & " ?"
data = Split (Trim (socket.GetLine), " ")
answer = Replace(data(3), "%20", " ")
If StrComp (answer, name) = 0 Then
socket.SendLine "player id " & i-1 & " ?"
data = Split (Trim (socket.GetLine), " ")
id = data(3)
End If
Next
If StrComp (id, "") = 0 Then
text = "Unable to find the Squeezebox with the name '" &_
name & "' !"
MsgBox text, vbOKOnly + vbCritical, "Squeeze Error"
End If
DeterminePlayerId = id
End Function
Sub SqueezeInitOptions (Sheet)
Dim x1
Dim x2
Dim width
Dim height
Dim y
x1 = 20
x2 = 210
y = -10
width = 250
height = 20
y = y + 30
Set label = SDB.UI.NewLabel (Sheet)
label.Common.SetRect x1, y, width, height
label.Caption = "Enable Squeezebox support:"
Set edit = SDB.UI.NewCheckBox (Sheet)
edit.Common.SetRect x2, y, width, height
edit.Checked = enableSqueeze
edit.Common.ControlName = "enableSqueeze"
y = y + 50
Set label = SDB.UI.NewLabel (Sheet)
label.Common.SetRect x1, y, width, height
label.Caption = "Squeeze Center IP address:"
Set edit = SDB.UI.NewEdit (Sheet)
edit.Common.SetRect x2, y, width, height
edit.Text = squeezeCenterIp
edit.Common.ControlName = "squeezeCenterIp"
y = y + 30
Set label = SDB.UI.NewLabel (Sheet)
label.Common.SetRect x1, y, width, height
label.Caption = "Player Name:"
Set edit = SDB.UI.NewEdit (Sheet)
edit.Common.SetRect x2, y, width, height
edit.Text = playerName
edit.Common.ControlName = "playerName"
y = y + 50
Set label = SDB.UI.NewLabel (Sheet)
label.Common.SetRect x1, y, width, height
label.Caption = "MediaMonkey Path 1:"
Set edit = SDB.UI.NewEdit (Sheet)
edit.Common.SetRect x2, y, width, height
edit.Text = mediaMonkeyPath1
edit.Common.ControlName = "mediaMonkeyPath1"
y = y + 30
Set label = SDB.UI.NewLabel (Sheet)
label.Common.SetRect x1, y, width, height
label.Caption = "SqueezeCenter Path 1:"
Set edit = SDB.UI.NewEdit (Sheet)
edit.Common.SetRect x2, y, width, height
edit.Text = squeezeCenterPath1
edit.Common.ControlName = "squeezeCenterPath1"
y = y + 30
Set label = SDB.UI.NewLabel (Sheet)
label.Common.SetRect x1, y, width, height
label.Caption = "MediaMonkey Path 2:"
Set edit = SDB.UI.NewEdit (Sheet)
edit.Common.SetRect x2, y, width, height
edit.Text = mediaMonkeyPath2
edit.Common.ControlName = "mediaMonkeyPath2"
y = y + 30
Set label = SDB.UI.NewLabel (Sheet)
label.Common.SetRect x1, y, width, height
label.Caption = "SqueezeCenter Path 2:"
Set edit = SDB.UI.NewEdit (Sheet)
edit.Common.SetRect x2, y, width, height
edit.Text = squeezeCenterPath2
edit.Common.ControlName = "squeezeCenterPath2"
y = y + 50
Set label = SDB.UI.NewLabel (Sheet)
label.Common.SetRect x1, y, width, height
label.Caption = "Power Off on Exit:"
Set edit = SDB.UI.NewCheckBox (Sheet)
edit.Common.SetRect x2, y, width, height
edit.Checked = powerOffOnExit
edit.Common.ControlName = "powerOffOnExit"
End Sub
Sub SqueezeSaveOptions (Sheet)
oldEnableSqueeze = enableSqueeze
Set edit = Sheet.Common.ChildControl ("enableSqueeze")
previousEnableSqueeze = enableSqueeze
enableSqueeze = edit.Checked
Set edit = Sheet.Common.ChildControl ("squeezeCenterIp")
squeezeCenterIp = edit.Text
Set edit = Sheet.Common.ChildControl ("playerName")
previousPlayerName = playerName
playerName = edit.Text
Set edit = Sheet.Common.ChildControl ("mediaMonkeyPath1")
mediaMonkeyPath1 = edit.Text
Set edit = Sheet.Common.ChildControl ("squeezeCenterPath1")
squeezeCenterPath1 = edit.Text
Set edit = Sheet.Common.ChildControl ("mediaMonkeyPath2")
mediaMonkeyPath2 = edit.Text
Set edit = Sheet.Common.ChildControl ("squeezeCenterPath2")
squeezeCenterPath2 = edit.Text
Set edit = Sheet.Common.ChildControl ("powerOffOnExit")
powerOffOnExit = edit.Checked
Const ForWriting = 2
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set file = objFSO.OpenTextFile (settingsFile, ForWriting, True)
file.WriteLine ("enableSqueeze=" & enableSqueeze)
file.WriteLine ("squeezeCenterIp=" & squeezeCenterIp)
file.WriteLine ("playerName=" & playerName)
file.WriteLine ("mediaMonkeyPath1=" & mediaMonkeyPath1)
file.WriteLine ("squeezeCenterPath1=" & squeezeCenterPath1)
file.WriteLine ("mediaMonkeyPath2=" & mediaMonkeyPath2)
file.WriteLine ("squeezeCenterPath2=" & squeezeCenterPath2)
file.WriteLine ("powerOffOnExit=" & powerOffOnExit)
file.Close
EnableDisableSqueeze
End Sub
Sub SqueezeLoadOptions (file)
Const ForReading = 1
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile (file, ForReading)
Do Until objTextFile.AtEndOfStream
line = objTextFile.Readline
data = Split(line , "=")
If StrComp(data(0), "enableSqueeze") = 0 then
enableSqueeze = data(1)
previousEnableSqueeze = enableSqueeze
End If
If StrComp(data(0), "squeezeCenterIp") = 0 then
squeezeCenterIp = data(1)
End If
If StrComp(data(0), "playerName") = 0 then
playerName = data(1)
previousPlayerName = playerName
End If
If StrComp(data(0), "mediaMonkeyPath1") = 0 then
mediaMonkeyPath1 = data(1)
End If
If StrComp(data(0), "squeezeCenterPath1") = 0 then
squeezeCenterPath1 = data(1)
End If
If StrComp(data(0), "mediaMonkeyPath2") = 0 then
mediaMonkeyPath2 = data(1)
End If
If StrComp(data(0), "squeezeCenterPath2") = 0 then
squeezeCenterPath2 = data(1)
End If
If StrComp(data(0), "powerOffOnExit") = 0 then
powerOffOnExit = data(1)
End If
Loop
EnableDisableSqueeze
End Sub
Sub SqueezePause
If enableSqueeze Then
SendCommand "pause"
End If
End Sub
Sub SqueezePlay
If enableSqueeze Then
song = SDB.Player.CurrentSong.Path
song = Replace (song, mediaMonkeyPath1, squeezeCenterPath1)
song = Replace (song, mediaMonkeyPath2, squeezeCenterPath2)
SendCommandParam "playlist play", song
End If
End Sub
Sub SqueezeOnShutdown
If enableSqueeze Then
If powerOffOnExit then
SendCommand "power 0"
SDB.Tools.Sleep 1000
End If
socket.Close
End If
End Sub
Code: Select all
enableSqueeze=True
squeezeCenterIp=192.168.0.200:9090
playerName=Squeezebox
mediaMonkeyPath1=\\HUSHY\music1
squeezeCenterPath1=/home/marcel/Music/disk1
mediaMonkeyPath2=\\HUSHY\music2
squeezeCenterPath2=/home/marcel/Music/disk2
powerOffOnExit=True
Wow, thank you for the code.m_schuitema wrote:Hi folks, I am also a squeezebox & MM lover and I made a script with settings to control squeezebox by using MM as the UI. So when MM starts playing a song it will send a command to the squeezecenter to start playing the same song. Works cool (at least at my place).