TurnipMan wrote:
> It's on a Rpi2 with Max2Play so it's linux.
:o
than you should start with something like that (unless another user has
a better idea..)
- check if max2play has netcat installed eg writing nc [return] in
your shell
- get the macadress from the Chromcast device
- add these lines to a file and name that "autoplay.sh"
Code:
--------------------
#! /bin/sh
###vars:
## change that to the mac adress from the Chromcast Device
playerID="50:40:30:20:10"
#the stream/playlist
my_playlist="/playlist_path/playlist.m3u"
server=127.0.0.1
port=9090
connected=$(printf "$playerID connected ?\nexit\n" |nc $server $port|cut -d '
' -f 3)
if [ ! $connected = 1 ]
then
exit 1
fi
playerstatus=$(printf "$playerID power ?\nexit\n" |nc $server $port|cut -d '
' -f 3)
if [ ! $playerstatus = 1 ]
then
echo "powering player on"
printf "$playerID power 1\nexit\n"|nc $server $port
else
echo "player is on"
fi
playermode=$(printf "$playerID mode ?\nexit\n" |nc $server $port|cut -d ' '
-f 3)
if [ ! $playermode = play ]
then
echo "nothing to play"
echo "try to play players playlist"
printf "$playerID play\nexit\n"|nc $server $port
sleep 2
playermode=$(printf "$playerID mode ?\nexit\n"|nc $server $port|cut -d ' ' -f
3)
if [ ! $playermode = play ]
then
echo "no playlist loaded we play $my_playlist now"
printf "$playerID playlist play $my_playlist\nexit\n"|nc $server $port
fi
else
echo "playing"
fi
exit 0
--------------------
place that file somewhere under /opt or /usr/local/bin and make it
executeable by chmod +x /path/filename
use sudo crontab -e
and add something like:
Code:
--------------------
*/15 * * * * /path/filename.sh
--------------------
to start that script each 15 mins.
I know its kind off ugly and not perfect cause it runs all 15 minutes
and i dont know whats happen, when the device is powered on but paused
cause you want to make a phonecall and so on.
So it "NOT" really what you looking for it doesnt handle a "device
connected and just powered on" - it just a device is connected and it
should play my playlist/stream.
Gruss
Jan
------------------------------------------------------------------------
DJanGo's Profile: http://forums.slimdevices.com/member.php?userid=1516
View this thread: http://forums.slimdevices.com/showthread.php?t=105263
_______________________________________________
discuss mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/discuss