paul- wrote:
> .local is from avahi/zeroconf. pCP can send curl commands to the LMS
> server all day long. There are other ways to automatically find IP
> address of your LMS server....much lighter weight than avahi
> The way we prefer to do it in pcp, is to look at the local device and
> see what LMS server squeezelite is connected to.
>
Thanks for this suggestion. I now wrote a small script that gets called
from Lircrc (in stead of hardcoding the full curl command for every
single key). It adds an extra layer, which I don't like, but it's much
easier to maintain and indeed does not require a reference to the server
name anymore either. The script looks like this:
(note that the remote controls its own player directly using "pcp up",
pcp down", etc.. But it also starts preset radio stations on the leading
player and volume and power functions on a small piZero player in a
connected room, by curling json commands to the server)
Code:
--------------------
#!/bin/sh
LMSIP=$(netstat -nt 2>&1 | grep :3483 | grep ESTABLISHED | uniq -f 4 | awk '{
print $5 }' | grep :3483 | awk -F: '{ print $1 }')
#MAC address for external players
bathroomMAC="b8:27:eb:8a:xxxx"
livingroomMAC="aa:aa:bd:41:xxxx"
# only preset commands go to main player (format "lmsjson.sh preset 1") all
others go to bathroom (format "lmsjson.sh power 0", max 3 params)
if [ $1 = "preset" ]
then
command='{"id": 1, "method": "slim.request", "params":["'$livingroomMAC'",
["favorites", "playlist", "play", "item_id:2.'$2'"]]}'
else
command='{"id": 1, "method": "slim.request", "params":["'$bathroomMAC'",
["'$1'", "'$2'", "'$3'"]]}'
fi
#echo $LMSIP
#echo $command
eval "curl -X POST -d '"$command"' "$LMSIP":9000/jsonrpc.js"
--------------------
The lircrc files now only contains lines like this:
Code:
--------------------
begin
prog = irexec
remote = WD_TV_LIVE_REMOTE
button = KEY_3
repeat = 0
config = /home/tc/lmsjson.sh preset 2
end
--------------------
One odd thing I noticed though: It seems that squeezelite is also
connected to and listening to Lirc, because the mute key (which is not
in my lircrc file) mutes the player. Since LMS seems to have 'issues
with Mute/Unmute '
(https://forums.slimdevices.com/showthread.php?109624-Announce-Material-Skin&p=988645&viewfull=1#post988645)I
want to avoid that.. But I can't figure out how squeezelite is
configured to respond to Lirc. There is nothing in my Lirrc file for the
mute key, so it seems to be at a lower level. Would anybody know where I
can find the mapping for this connection?
------------------------------------------------------------------------
jeroen2's Profile: http://forums.slimdevices.com/member.php?userid=70418
View this thread: http://forums.slimdevices.com/showthread.php?t=109270
_______________________________________________
unix mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/unix