Maybe there are easier solutions, but that's a small solution that I've
written right now:
You need two scripts:
"playerstatus.sh" gets the status of your players from the server
"activeplayer.sh" tells you if any of the players is streaming right
now
You need to install "expect" to make the scripts work.
PLAYERSTATUS.SH
Code:
--------------------
#!/usr/bin/expect -f
# Get the player status of your local SBS
# Your server name/ip
set host media
# Server CLI port (9090)
set port 9090
# Set your playerIds here (separated by ";")
set players "00:04:20:XX:XX:XX;00:04:20:YY:YY:YY;00:04:20:ZZ:ZZ:ZZ"
# Credentials are only needed if enabled on server
set user username
set pass password
spawn telnet $host $port
send "login $user $pass\n"
foreach player [ split $players {";"} ] {
send "$player status\n"
}
sleep 1
send "exit\n"
interact
--------------------
ACTIVEPLAYER.SH
Code:
--------------------
#!/bin/sh
./playerstatus.sh | grep "mode%3Aplay" > /dev/null 2>&1
if [ "$?" = "0" ]; then
echo "At least one player is streaming right now!"
else
echo "No player is streaming!"
fi
--------------------
Of course, you could improve the script by fetching the player ids from
the server, but that's homework for you. ;-)
--
flattermann
Home of 'SqueezeCommander' (http://www.squeezecommander.com) - The
SqueezeBox Remote Control App for Android
------------------------------------------------------------------------
flattermann's Profile: http://forums.slimdevices.com/member.php?userid=33169
View this thread: http://forums.slimdevices.com/showthread.php?t=76092
_______________________________________________
unix mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/unix