Greg Erskine wrote:
> hi kolossos4730,
>
> Good to see you have something working!;)
>
> By DIY, I mean any hacking, hardware or software. We don't do a lot of
> discussion in this thread about actual coding, its more about adjusting
> the piCorePlayer settlings and options.
>
> BTW: I don't understand why you check for the value of $GPIO_VALUE
> before setting it (ensuring its a toggle). Is there a weird initial
> condition where it is incorrectly set? Does setting GPIO to 1, when it
> is already 1, a problem? Do you understand what $? is?
>
> regards
> Greg
Greg,
I know it's a niche market but in my case specific to piCorePlayer as
there is no support for unmuting the pi-AMP (yet?). Maybe others could
benefit from this script.
Code:
--------------------
RESULT=`( echo "$PI_MAC_ADDRESS $COMMAND"; echo exit ) | nc
$LMS_IP_ADDRESS $LMS_CLI_PORT_NUMBER`
echo $RESULT | grep "mode%3Aplay" > /dev/null 2>&1
if [ $? == 0 ]; then
--------------------
If I understand correctly the first line uses nc to send a LMS CLI
command to the LMS server. The second line in combination with the grep
command searches for the "mode%3Aplay" string. The third line evaluates
the exit code of this search. If the exit code equals 0 ($? == 0) then
the search string was found and Squeezelite is in a playing state. Any
other exit code results in a stopped state.
I check the value of GPIO 22 as I thought it would be better to only
set/unset GPIO 22 if the previous state was different from the desired
state.
Regards,
Arie
------------------------------------------------------------------------
kolossos4730's Profile: http://forums.slimdevices.com/member.php?userid=63988
View this thread: http://forums.slimdevices.com/showthread.php?t=97803
_______________________________________________
unix mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/unix