LinuxMCE Forums

General => Installation issues => Topic started by: felpouse on August 29, 2008, 07:11:26 pm

Title: SqueezeCenter for squeezebox
Post by: felpouse on August 29, 2008, 07:11:26 pm
Dear all,

I would like to know if it's possible to compile (howto to do it) or create a new .deb package of the squeezecenter and next install on LinuxMCE.

The actual release is the 6.5.4 but the new one is growing quickly. Because at today we have the new 7.2 release.

Anyone is knowing if there are problems in doing that or not? If it's possible could someone tell me the possible procedure to generate the new package. Because I saw that the other package related to slimserver have dependencises with the 6.5.4 .deb package.

Few months ago I'll try to do it, using the tgz package and modifing the script (in the past from 6.2.2 to 6.5.4 worked well) but without success.

Best regards

Luke

P.S. : if are necessary more explanation don't esitate to send me back question about that .
Title: Re: SqueezeCenter for squeezebox
Post by: jspeckman on September 02, 2008, 09:22:11 pm
While not a procedure for generating a package, You can take a look at the howto I wrote for upgrading SlimServer.

http://wiki.linuxmce.org/index.php/Upgrading_SlimServer (http://wiki.linuxmce.org/index.php/Upgrading_SlimServer)

May or may not be useful to you.

Jason
Title: Re: SqueezeCenter for squeezebox
Post by: felpouse on September 03, 2008, 04:10:08 pm
Hi Jason,

I've checked your procedure. This similar to one that I've used with the old linuxmce 0704 release for upgrading the slimserver from 6.2.2 to 6.5.4.

But the actual 6.5.4 deb package is structured in different mode. And could be necessary to change many scripts files for the starting and stopping processes.

The possibility to create a new .deb package would be a great solution, also for the dependences for these packages pluto-slim-server-streamer and pluto-slimserver-plugin that have the dependences from this one: slimserver (6.5.4 release).

Thanks for your support.

Best regards,

Luke
Title: Re: SqueezeCenter for squeezebox
Post by: felpouse on September 08, 2008, 11:29:29 am
Dear all,

actually I was able to do it, but not in a perfect way.

First of all I've downloaded the .tgz package with the last release and scompacted into the /home directoy.
Then I've created a simlink to it ( ln -s squeezecenter -> squeezecenter-7.2 ).

I've cancelled the /etc/init.d/slimserver script and do an " update-rc.d slimserver remove " .

And do this :

                          chown -R slimserver:nogroup squeezecenter-7.2


Then I've create a new script /etc/init.d/squeezecenter and added to the /etc/rc.local script.

The script is like that:

------------------------------------------------------------------------------------------------------
#!/bin/bash

PORT="${1:-7890}"
#
SQUEEZE_SERVER_HOME=/home/squeezecenter;
#
PARAMS="--audiodir /home/public/data/audio --cachedir /home/squeezecenter --daemon --user slimserver --cliport $PORT --cliaddr 127.0.0.1 --prefsdir /etc/slimserver --noupnp"
#
exec `which perl` $SQUEEZE_SERVER_HOME/slimserver.pl $PARAMS;
------------------------------------------------------------------------------------------------------

I've modified also this script:

more /usr/pluto/bin/LaunchSlimServer.sh
------------------------------------------------------------------------------------------------------
#!/bin/bash

PORT="${1:-7890}"
PARAMS="--cliport $PORT --audiodir /home/public/data/audio"

sed -ri "s,SLIMOPTIONS=.*,SLIMOPTIONS=\"$PARAMS\",g" /etc/default/slimserver

####### invoke-rc.d slimserver restart
invoke-rc.d rc.local start
------------------------------------------------------------------------------------------------------

Then I've tested it doing a complete shutdown of the system and then powered on. Actually I've the new release working well.
But I need some suggestion to create a best script in the /etc/init.d/ directory. The script would be able to do a start, stop, restart and conrestart. Similar to all the other script.
If someone is able to give some soggestion on do it, it would be a great solution.

Best regards,

Luke

P.S.: the integration in LinuxMCE at the moment is working perfectly!!!   ;)
Title: Re: SqueezeCenter for squeezebox
Post by: tschak909 on September 08, 2008, 01:37:17 pm
Dude, You're awesome! :)

Let's try to get this tested with more people, and then if it works okay, let's try to merge it in.

-Thom
Title: Re: SqueezeCenter for squeezebox
Post by: felpouse on September 10, 2008, 08:11:55 pm
Hi Thom and all other people,

thanks for your comment. This evening thanks to this great wiki page on internet:

http://wiki.debian.org/SlimServerHowto

I created a little bit better init script. This one is also able to start, stop and restart all the services related to the new squeezecenter release. I think could be possible to reuse it also for the next close future releases I mean.

I'll attach the new script and following the modification that were necessary for the porpouse:

-----------------------------------------------------------------
more /etc/rc.local
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

# /etc/init.d/squeezecenter

exit 0
-----------------------------------------------------------------

more /usr/pluto/bin/LaunchSlimServer.sh
#!/bin/bash

PORT="${1:-7890}"
PARAMS="--cliport $PORT --audiodir /home/public/data/audio"

sed -ri "s,SLIMOPTIONS=.*,SLIMOPTIONS=\"$PARAMS\",g" /etc/default/slimserver

####### invoke-rc.d slimserver restart
invoke-rc.d squeezecenter restart
####### invoke-rc.d rc.local start
-----------------------------------------------------------------

I've tested it both doing a complete shutdown and a complete reboot of the core/MD system. At the moment all the services seems to be working well.
If someone else would like to test it, would be great. And also if someone would like to send me some suggestion for correction or modification, I'm here.

Best regards,

Luke

P.S. : here the squeezecenter script  ----------- >

-----------------------------------------------------------------------------------------------------

#!/bin/sh

# slimserver init script for Debian Linux
#
# This script expects slimserver to be installed in
# /home/squeezecenter
#

DAEMON=/home/squeezecenter/slimserver.pl
PIDFILE=/var/cache/slimserver/squeezecenter.pid
MYSQLPIDFILE=/home/squeezecenter/squeezecenter-mysql.pid
LOGFILE=/var/log/slimserver/squeezecenter.log
CACHEDIR=/var/cache/slimserver
PORT="${1:-7890}"
DIRECTORY="squeezecenter"
USER=slimserver
UIDUSER="116"
PREFSDIR=/etc/slimserver
PREFSFILE="${PREFSDIR}/slimserver.pref"
AUDIODIR=/home/public/data/audio
CLIADDR="127.0.0.1"
mDNS=/home/squeezecenter/Bin/i386-linux/mDNSResponderPosix
SLIMSERVER_OPTS=""

test -x ${DAEMON} || exit 0

case "$1" in
   start) echo -n "Starting SqueezeCenter: "
   HOME=/home/$DIRECTORY   
   start-stop-daemon --start --quiet --exec $DAEMON -- --daemon \
   --cachedir=${CACHEDIR} --audiodir=${AUDIODIR} --prefsdir=${PREFSDIR} --user=${USER} \
   --cliport={$PORT} --cliaddr={$CLIADDR} --prefsfile=${PREFSFILE} --pidfile=${PIDFILE} \
   --logfile=${LOGFILE} --cachedir={CACHEDIR} --noupnp ${SLIMSERVER_OPTS}   
   echo "Done"
   ;;
            
   stop) echo -n "Stopping SqueezeCenter: "   
   start-stop-daemon --stop --quiet --user ${UIDUSER} --pidfile ${PIDFILE} --retry 5
   start-stop-daemon --stop --quiet --user ${UIDUSER} --pidfile ${MYSQLPIDFILE} --retry 5
   start-stop-daemon --stop --quiet --user ${UIDUSER} --exec ${mDNS} --retry 5
   rm $PIDFILE
   echo "Done"
   ;;
            
   force-reload|restart) $0 stop
   $0 start
   ;;
            
   *) echo "Usage: $0 {start|stop|restart|force-reload}"
   exit 1;
               
   ;;
esac

exit 0
Title: Re: SqueezeCenter for squeezebox
Post by: niz23 on September 10, 2008, 10:16:55 pm
Great work felpouse.

Will try with squeezeslave when I have my new core running everything I need.

/niz23
Title: Re: SqueezeCenter for squeezebox
Post by: PeteK on September 10, 2008, 11:51:45 pm
You can also get squeezecenter using apt-get install squeezecenter.  This will uninstall the pluto-slimserver-streamer package, so you will have to re-install it with dpkg.

I had talked with Daniel about removing the CLI port reassignment from the lmce script and using the default port.  This is a little bit clearer.  I'll try to get that checked in in the next couple of days.

Title: Re: SqueezeCenter for squeezebox
Post by: felpouse on September 11, 2008, 12:16:25 am
Hi Petek,

thanks for your suggestion. But few months ago I'll try it, but it happened that from a reboot or from a possible shutdown for maintenance, the system reinstall the old one that belongs to the linuxmce version. At that period I didn't make more investigation about that.
From that strange behavior I started to try to make some changes on the scripting for use the new one release.

For the moment, who wants to try the script, this is the new one. I made some mistakes with the variables environment:
------------------------------------------------------------------------------------------------------
#!/bin/sh

# slimserver init script for Debian Linux
#
# This script expects slimserver to be installed in
# /home/squeezecenter
#

DAEMON=/home/squeezecenter/slimserver.pl
PIDFILE=/var/cache/slimserver/squeezecenter.pid
MYSQLPIDFILE=/home/squeezecenter/squeezecenter-mysql.pid
LOGFILE=/var/log/slimserver/squeezecenter.log
CACHEDIR=/var/cache/slimserver
PORT='7890'
DIRECTORY="squeezecenter"
USER=slimserver
UIDUSER="116"
PREFSDIR=/etc/slimserver
PREFSFILE="${PREFSDIR}/slimserver.pref"
AUDIODIR=/home/public/data/audio
CLIADDR='127.0.0.1'
mDNS=/home/squeezecenter/Bin/i386-linux/mDNSResponderPosix
SLIMSERVER_OPTS=""

test -x ${DAEMON} || exit 0

case "$1" in
      start) echo -n "Starting SqueezeCenter: "
              HOME=/home/$DIRECTORY   
              start-stop-daemon --start --quiet --exec $DAEMON -- --daemon \
             --cachedir=${CACHEDIR} --audiodir=${AUDIODIR} --prefsdir=${PREFSDIR} --user=${USER} \
             --cliport=${PORT} --cliaddr=${CLIADDR} --prefsfile=${PREFSFILE} --pidfile=${PIDFILE} \
             --logfile=${LOGFILE} --cachedir=${CACHEDIR} --noupnp ${SLIMSERVER_OPTS}   
             echo "Done"
         ;;
            
      stop) echo -n "Stopping SqueezeCenter: "   
             start-stop-daemon --stop --quiet --user ${UIDUSER} --pidfile ${PIDFILE} --retry 5
             start-stop-daemon --stop --quiet --user ${UIDUSER} --pidfile ${MYSQLPIDFILE} --retry 5
             start-stop-daemon --stop --quiet --user ${UIDUSER} --exec ${mDNS} --retry 5
             rm $PIDFILE
            echo "Done"
            ;;
            
      force-reload|restart) $0 stop
             $0 start
            ;;
            
      *) echo "Usage: $0 {start|stop|restart|force-reload}"
             exit 1;
               
            ;;
esac

exit 0
------------------------------------------------------------------------------------------------------

Sometimes the stopping procedure at the moment is not working well.  :(
I hope to make it working asap .......

Best regards,

Luke
Title: Re: SqueezeCenter for squeezebox
Post by: colinjones on November 24, 2008, 04:56:19 am
I am struggling to get my Squeezebox Boom working in LMCE. Initially it recognised it and added it to the system. I updated the firmware, but the SqueezeBox is saying that SqueezeCenter needs to be updated. From the web site this needs 7.2.1 to support the Boom. Either way I need to update from Slimserver to SqueezeCenter...

In this thread it isn't clear to me whether the rc.local pieces of the discussion are still needed. By the final felpouse post it looked like he was just working with init.d scripts so that is what I focused on. I have downloaded the tgz file and expanded it into /home/squeezecenter-7.2.1 and created the symlink to squeezecenter in the same directory.

I then copied and pasted the last version of the slimserver init.d script in the previous post into /etc/init.d/slimserver (after backing up the old version). chmod to be the same as all the other scripts.

Now when I try to /etc/init.d/slimserver start ... i get:

Starting SqueezeCenter: Use of uninitialized value in join or string at /usr/share/perl/5.8/File/Spec/Unix.pm line 37.
Use of uninitialized value in pattern match (m//) at /home/squeezecenter-7.2.1/Slim/Utils/Prefs.pm line 275.
/etc/init.d/slimserver: line 32: --prefsdir=/etc/slimserver: No such file or directory
/etc/init.d/slimserver: line 35: --pidfile=/var/cache/slimserver/squeezecenter.pid: No such file or directory
Done

I have no idea why! /etc/slimserver does exist but /var/cache/slimserver/squeezecenter.pid does not - I assumed this would only get created once the process had started...

Can anyone please help on this?
Title: Re: SqueezeCenter for squeezebox
Post by: felpouse on November 24, 2008, 10:29:33 am
Hi colin,

I know that my procedure could be a little confused. I would like to try to make a summary for the procedure that I followed.

First of all, but could be or not, I've deleted the slimserver script from the /etc/init.d and put the new one with the name squeecenter (added in the init.d process and deleted the old one from it). The content of the script is the last one in the post.

Then I've dowloaded the .tgz into the /home dir and unzipped there. Than created the simlink with squeezecenter, like this:

lrwxrwxrwx  1 root       root          19 2008-10-23 21:08 squeezecenter -> squeezecenter-7.2.1/
drwxrwxr-x 17 slimserver nogroup     4096 2008-09-10 23:46 squeezecenter-7.2/
drwxrwxr-x 14 slimserver nogroup     4096 2008-11-12 20:32 squeezecenter-7.2.1/

You have to check that all the directories, subdir and the files had the chown like this (all with slimserver:nogroup) .

Also the /etc/slimserver/  :

ls -alF /etc/slimserver/
total 76
drwxr-xr-x   3 slimserver nogroup  4096 2008-11-24 10:08 ./
drwxr-xr-x 126 root       root    12288 2008-11-24 10:22 ../
-rw-r--r--   1 slimserver nogroup  5839 2008-09-29 00:37 convert.conf
-rw-r--r--   1 slimserver nogroup  4706 2008-09-07 18:05 log.conf
drwxr-xr-x   2 slimserver nogroup  4096 2008-10-23 21:17 plugin/
-rw-r--r--   1 slimserver nogroup 19429 2008-11-24 10:08 server.prefs
-rw-r--r--   1 slimserver nogroup  5936 2008-09-07 16:40 slimserver.pref
-rw-r--r--   1 slimserver nogroup  5856 2008-09-07 17:43 squeezecenter.pref
-rw-r--r--   1 slimserver nogroup  4032 2008-09-29 00:37 types.conf

Also too the /var/cache/slimserver  :

drwxr-xr-x  6 slimserver nogroup    4096 2008-11-22 23:15 ./
drwxr-xr-x 21 root       root       4096 2008-09-07 14:55 ../
drwxr-xr-x 18 slimserver nogroup    4096 2008-09-17 21:03 Artwork/
-rw-r--r--  1 slimserver nogroup     320 2008-11-23 23:15 cookies.dat
-rw-r--r--  1 slimserver nogroup     995 2008-11-09 20:50 favorites.opml
-rw-r--r--  1 slimserver nogroup    1209 2008-10-25 17:46 favorites.opml.backup
drwxr-xr-x 18 slimserver nogroup    4096 2008-09-17 21:03 FileCache/
-rw-r--r--  1 slimserver nogroup  110086 2008-10-23 21:09 fontcache
-rw-r--r--  1 slimserver nogroup     731 2008-10-23 21:09 infobrowser.opml
-rw-r--r--  1 slimserver nogroup     165 2008-09-10 23:47 infobrowser.opml.backup
-rw-r--r--  1 slimserver nogroup 9642842 2008-09-10 23:47 jive_7.2_r2873.bin
-rw-r--r--  1 slimserver nogroup      61 2008-09-17 15:50 jive.version
-rw-r--r--  1 slimserver nogroup      74 2008-11-22 23:15 mDNS.conf
-rw-r--r--  1 slimserver nogroup    1092 2008-11-22 23:15 my.cnf
-rw-r--r--  1 slimserver nogroup     170 2008-09-17 21:15 myradio.opml
-rw-r--r--  1 slimserver nogroup     208 2008-09-17 21:15 myradio.opml.backup
drwxr-xr-x  4 slimserver nogroup    4096 2008-11-22 23:15 MySQL/
-rw-rw----  1 slimserver nogroup   19070 2008-11-22 23:15 mysql-error-log.txt
-rw-r--r--  1 slimserver nogroup   20020 2008-11-22 23:15 plugin-data.yaml
-rw-rw----  1 slimserver nogroup       5 2008-11-22 23:15 squeezecenter-mysql.pid
srwxrwxrwx  1 slimserver nogroup       0 2008-11-22 23:15 squeezecenter-mysql.sock=
-rw-r--r--  1 root       root          4 2008-11-22 23:15 squeezecenter.pid
-rw-r--r--  1 slimserver nogroup  139190 2008-10-23 21:08 stringcache
drwxr-xr-x  3 slimserver nogroup    4096 2008-11-12 20:33 templates/

Thats it. If you try to start it it's possible that you receive some errors. Check the /home/squeezecenter subdirectory, because the first time you start it the process create subdirectory with chown not correted, like Logs/ , if I remember .

Please let me know if my new explanation help you or not.

Best regards,

Luke
Title: Re: SqueezeCenter for squeezebox
Post by: caiman on November 24, 2008, 11:26:51 am
so last night I just added the following line to /etc/apt/sources.list :

Code: [Select]
deb http://debian.slimdevices.com stable main
and installed squeezecenter via apt
Code: [Select]
apt-get update
apt-get install squeezecenter
then I changed the CLI port and music directories in the squeezecenter web GUI as explained on the wiki. Rebooted, and both my the squeezebox and my boom seem to work fine.

Anything wrong with that ?

Oh yes, I did not re-install yet the pluto-slimserver-streamer package as I didn't have the .deb at hand. Do I need it ?

Caiman

Title: Re: SqueezeCenter for squeezebox
Post by: felpouse on November 24, 2008, 11:47:35 am
Hi Caiman,

I think that you need it, if you would like to use with LinuxMCE.

And also the other package, the plugin. Here the list of the packages :

dcerouter_89303:~# dpkg -l | grep slim

ii  pluto-slim-server-streamer                 2.0.0.44.0804112200                 
ii  pluto-slimserver-plugin                      2.0.0.44.0804112200     

And if I remember, one or both of them have dependencies related to the slimserver package 6.5.4 when you try to install it.

Luke

P.S.: if you reinstall the old slimserver package, the new one will be deinstalled.                                       
Title: Re: SqueezeCenter for squeezebox
Post by: caiman on November 24, 2008, 05:41:39 pm
Thanks Luke.

Let me paste here the commands I have put in to install the streamer for the benefit of others
Code: [Select]
dpkg -i --ignore-depends=slimserver /usr/pluto/deb-cache/pluto-slim-serverstreamer_2.0.0.44.0804112200_i386.deb

Now I have all three packages installed:
Code: [Select]
dcerouter_73xxx:~# dpkg -l | grep slim
ii  pluto-slim-server-streamer                 2.0.0.44.0804112200                  <insert up to 60 chars description>
ii  pluto-slimserver-plugin                    2.0.0.44.0804112200                  <insert up to 60 chars description>
rc  slimserver                                 6.5.4                                Streaming Audio Server
dcerouter_73943:~# dpkg -l | grep squeeze
ii  squeezecenter                              7.2.1                                Streaming Audio Server
Title: Re: SqueezeCenter for squeezebox
Post by: colinjones on November 24, 2008, 08:36:52 pm
Thanks guys! I tried doing what Caiman suggested and it worked just fine! Testing now to make sure all is ok... thanks for both your help!
Title: Re: SqueezeCenter for squeezebox
Post by: bulek on November 24, 2008, 09:23:02 pm
Thanks guys! I tried doing what Caiman suggested and it worked just fine! Testing now to make sure all is ok... thanks for both your help!
Please post to Wiki if you already didn't....

Regards,

Bulek.
Title: Re: SqueezeCenter for squeezebox
Post by: colinjones on November 24, 2008, 09:31:37 pm
Don't worry, Bulek - I have every intention of updating the existing article to include this info... wonder if SqueezeCenter integration is currently in the 0810 branch? Thom are you listening? Is it?
Title: Re: SqueezeCenter for squeezebox
Post by: tschak909 on November 24, 2008, 09:32:50 pm
it's not. Somebody needs to d o it.

-Thom
Title: Re: SqueezeCenter for squeezebox
Post by: Zaerc on November 25, 2008, 02:01:09 am
Thanks Luke.

Let me paste here the commands I have put in to install the streamer for the benefit of others
Code: [Select]
dpkg -i --ignore-depends=slimserver /usr/pluto/deb-cache/pluto-slim-serverstreamer_2.0.0.44.0804112200_i386.deb

Now I have all three packages installed:
Code: [Select]
dcerouter_73xxx:~# dpkg -l | grep slim
ii  pluto-slim-server-streamer                 2.0.0.44.0804112200                  <insert up to 60 chars description>
ii  pluto-slimserver-plugin                    2.0.0.44.0804112200                  <insert up to 60 chars description>
rc  slimserver                                 6.5.4                                Streaming Audio Server
dcerouter_73943:~# dpkg -l | grep squeeze
ii  squeezecenter                              7.2.1                                Streaming Audio Server
So the dependency on "slimserver" should become a dependency on "squeezecenter", do I understand that correctly?
Title: Re: SqueezeCenter for squeezebox
Post by: caiman on November 25, 2008, 09:39:35 am
So the dependency on "slimserver" should become a dependency on "squeezecenter", do I understand that correctly?

as far as I understand, yes, that should be it.
Title: Re: SqueezeCenter for squeezebox
Post by: felpouse on November 25, 2008, 11:54:15 am
Hi all,

the packages pluto-slim-server-streamer and pluto-slimserver-plugin should point from now to the new squeezecenter package for the dependencies and not to slimserver.

Best regards,

Luke

P.S.: for caiman and colin, did you try more times to do a power off and a power on and/or a reboot after the installation of the new package? Because few months ago I did it, and after a power on my new version was overwrited by the slimserver package.
Title: Re: SqueezeCenter for squeezebox
Post by: colinjones on November 25, 2008, 12:37:03 pm
I did do a power off/on (but only once) and all seemed fine so far... I have noticed some feature limitations. For instance hitting Forward on the squeezebox in a play list just starts the same track again from the beginning. It would seem that the squeezebox would need to signal this back to squeezecenter, which in turn would need to send some kind of indication back through port 7890 to the DCE device, which presumably would need to send a message back to the media-plugin to process the play list position change (not sure this is how it works??) Haven't looked into it yet, but intend to telnet to port 7890 tomorrow and hit Forward to see if the squeezebox even sends anything that could trigger this process....

Also, internet radio streaming controlled through LCME doesn't work, but that isn't exactly surprising!
Title: Re: SqueezeCenter for squeezebox
Post by: hari on November 25, 2008, 06:51:40 pm
iirc one of m1ch43l's friends was working on that.

br, Hari
Title: Re: SqueezeCenter for squeezebox
Post by: Zaerc on November 25, 2008, 07:37:25 pm
So the dependency on "slimserver" should become a dependency on "squeezecenter", do I understand that correctly?

as far as I understand, yes, that should be it.

Hi all,

the packages pluto-slim-server-streamer and pluto-slimserver-plugin should point from now to the new squeezecenter package for the dependencies and not to slimserver.
...

I have changed the dependency for the pluto-slim-server-streamer package from "slimserver" to "squeezecenter", but pluto-slimserver-plugin never depended on "slimserver" to begin with. 

There is an updated package for pluto-slim-server-streamer available under the 0810 pre-alpha build now.

Title: Re: SqueezeCenter for squeezebox
Post by: colinjones on November 25, 2008, 09:45:40 pm
Just to update my previous post with some very basic findings.

When telnet'd into the CLI port, after issuing:

<MAC> client new
  and
listen 1

commands, the player reports everything the Squeezebox's user interface does. So when I hit Vol Up/Down or hit next track, it reports this back to the telnet session in detail. The main one that struck me as missing is that the media_plugin obviously only sends the current track in a playlist so the squeezebox doesn't see the whole play list, and is effectively playing just a single track until the end. Then presumably the Slimstreamer device receives the end of track message using the mechanism above, and media_plugin must then send the next track to be played. The upshot is that you cannot use the track forward/back on the player, it just restarts the same track again.

So at least in principle, the Slimstreamer device should be able to be extended to react to those track forward/back commands and respond appropriately. Same for keeping track of the volume level... So I guess the device must already be bidirectional to a point....
Title: Re: SqueezeCenter for squeezebox
Post by: tschak909 on November 26, 2008, 02:41:58 am
Yes, we need to modify both the streamer and the plugin to handle events from the panel and the remote..but.. meh ;-)

It was intended to be used from the Orbiter, and in that respect, it works great.

-Thom
Title: Re: SqueezeCenter for squeezebox
Post by: colinjones on November 26, 2008, 03:11:06 am
I guess I understand that the streamer is the actual DCE device that receives the commands to send a stream (via SqueezeCenter), etc. But could you explain, Thom, what the responsibilities of the plugin are, and how they differ from the responsibilities of the media_plugin?

Also, when the "streamer" commands the Squeezebox via the Squeezecenter to play a track, is the Squeezebox then simply finding the media itself on the shares and pulling it, or is the streamer actually sending the audio stream (presumably bypassing the sequeezecenter altogether for the actual audio data)?
Title: Re: SqueezeCenter for squeezebox
Post by: tschak909 on November 26, 2008, 05:02:18 am
The media plugin in and of itself is a base class.

But to understand the differences between plugins and devices, we must examine first where they load:

* Devices load as processes, they open a socket to the dce router on the core, and can run anywhere. They are self contained in and of themselves, and must get information from other devices with DCERouter as proxy.

* Plugins, are also devices, but they load in the memory space of DCERouter. This is very important because of the way that C++ handles objects...

Because the plugins load in the same memory space, they have access to the public and protected structures (classes, methods, objects, etc.)

read that again.

What does this enable?

keep in mind there are other plugins besides your own:

* Climate Plugin--Handles the high level climate code
* Lighting Plugin--Handles the high level lighting code
...
* Datagrid Plugin--Handles maintaining, populating, and selectively returning what parts of a data grid to display.
* Orbiter Plugin--Handles the high level maintenance of orbiters
* Media Plugin--Handles the high level aspects of media control, pipes, the file list UI, finding which streams to create, etc..


all of the things i describe above are intentionally compartmentalized and abstracted.

These things provide the house wide logic that the rest of the system hangs off of.

Now, with this explained, I can get to the point:

The media plugin implements the MH commands, the media handler commands.

the media handler needs

* a location of some media, this can be anything, a URL, a path, some sort of uber-proprietary resource locator, something...
* a media type, is this..audio...video...dvd....game...tv...
* an entertainment area, or areas.

optionally,
* a device or device template to prefer.

and some other little bits, but not important for this discussion.

The media handler, goes into the media plugin... and there is a join table specifying player device templates for media types (MythTV Player mapped to media type 1, Xine Player mapped to Media type 5, etc.) DeviceTemplate_MediaType

...but how does this tie into the plugin? don't worry, I'm coming to task very quickly...

keep in mind that i said that plugins can reference data structures....

Devices use the Connect() method to enter into their code.... Plugins use a different entry point than Connect()... Register().....

(slight edit, I was typing too fast) ;-)

If you look in Xine_Plugin, look at the Register() method in Xine_Plugin.cpp... what do you see?  .... you see a reference into the media plugin, for registering a media connection to the media player..the Xine player... passing in a reference to the xine plugin itself.

This completes the circle...and creates the backbone of an extendable plugin system.

Now, the registered media plugins, also have a device priority devicedata, so you can specify certain media plugins to have precedence over others....

but..what does the Plugin itself do?

The plugin itself is responsible for creating a concrete form of the MediaStream class in a unique type (XineMediaStream, for example, for xine player streams)..which contains special properties for that stream... whether it contains audio, or video, etc... look at the mediastream class itself for details.

The plugin is also responsible for finding devices within an entertainment area capable of fulfilling the media handler command (Xine Plugin looks for all the xine player devices in the entertainment areas specified.)

Once we know this, we can figure out, for example:

* If we started the media stream on one machine, and it's the same machine, maybe we just need to pass a local file?
* If the source and destination machines are different, or multiple machines, this means we have to set up some plumbing to hook up the player devices, don't we?

Once we know all this, we can create the stream, figure out what we need to pass to the players, and craft CMD_Play_Media commands, for example, pointed to the player devices.

Now keep in mind, stream in this case, is a _VERY_ abstract term. You have to handle any stream management yourself, whether you do this in the plugin, or at the players, is up to you.. plugins run on the core, and have access to data structures that you may need... devices are nice and isolated on the media directors, or even running on the core itself (in the case of the squeezebox devices).....

Now, i haven't looked at the slim server streamer stuff yet, but.. this should give you an idea of what's going on behind the scenes...

but why is it this way?

very simple. It's an abstraction pattern.

This allows you to create different devices that may have different transport semantics, but are capable of handling similar data (or the flip flop of that can also be true.)..and be able to swap them out depending on the need...and furthermore, to be able to intelligently handle the same piece of media differently, depending on the device it's being beamed to.

I'm sure you see the power in it now, ;-)

-Thom
Title: Re: SqueezeCenter for squeezebox
Post by: colinjones on November 29, 2008, 08:02:29 pm
holy crap, thom! I'm going on holidays today so I'm going to have to absorb this when I get back :) thanks for the detailed info tho! I've no doubt there will be more questions to come!

See you all in 3 weeks :)