jj_0 wrote: > I was thinking you could try to write an applet for it, but then I > discovered 'Headphone Switch' on > https://wiki.slimdevices.com/index.php/SqueezePlay_Applets.html > > Maybe that would work for you?
That applet looks interesting, you're so kind to keep an eye out for an answer to this weird request of mine. I've got a solution using a cobbled together set of plugins and behind the scenes cmd/sh files. I'm running a Windows installation for LMS. Before the details though, I am compelled to point out that it's amazing what one can do with all of these great plugins/applets/mods from this community! On the LMS server, I installed Squeezelite and named the player "Drone". Its job is to get turned on/off and be noticed by the Power Center plugin. It has no sound output. On the SB Kitchen Radio I created 2 KidsPlay macros. Button 5 turns Drone ON, Button 6 turns it OFF. For the global settings for the Power Center plugin, the path for the br/heyu contains the command "c:\Utils\toggle.cmd" 36664 which consists of this: @echo off c:\Utils\SSH\plink.exe -i c:\Utils\SSH\SB_KitchenRadio.ppk [email protected] /root/toggleJack.sh That command above uses the ssh command line client plink.exe to connect as root to my SB radio (using private key auth) and runs the command on the radio "/root/toggleJack.sh" toggleJack.sh is a crude shell script that looks for the amixer setting and switches it from headphone to speaker or vice versa: #!/bin/sh HEADPHONE="Item0: 'Headphone'" CURRSTATE=`amixer scontents | grep -i "$HEADPHONE"` if [ -n "$CURRSTATE" ]; then echo Setting Speaker /usr/bin/amixer -q sset Endpoint Speaker else echo Setting Headphone /usr/bin/amixer -q sset Endpoint Headphone fi So when you power on Drone, the Power Center plugin runs the toggle.cmd command on the LMS server, which ssh connects to the radio and runs the toggleJack.sh script. The whole process takes like 5 seconds to execute, i.e. really slow! But it works and I can listen to the radio speakers and don't need to unplug the headphone jack and lose the end of the wire under the bed :P I would love to see a way to bind a function to a physical button in an applet. I looked in the .lua for the "Headphone Switch" applet and it does stuff like function headphoneOn(self) self:infoMessage(self:string("TEXT_HEADSET_IS_ON"), 3000) os.execute("amixer -q sset Headphone 92%") os.execute("amixer -q sset Endpoint Headphone") Sample:setEffectAttenuation(Sample.MAXVOLUME / 4) end which looks interesting. I just don't know enough about LUA. +-------------------------------------------------------------------+ |Filename: temp.jpg | |Download: http://forums.slimdevices.com/attachment.php?attachmentid=36664| +-------------------------------------------------------------------+ ------------------------------------------------------------------------ EasyPeasy's Profile: http://forums.slimdevices.com/member.php?userid=37784 View this thread: http://forums.slimdevices.com/showthread.php?t=115626 _______________________________________________ Radio mailing list [email protected] http://lists.slimdevices.com/mailman/listinfo/radio
