Airplay status commandline

Raspberry Pi related support

Airplay status commandline

Postby neophyte » 01 Aug 2016, 15:39

I'm using a Rpi3 with HifiBerry DAC+

I have a relay, that turns on and off my amplifier, connected to GPIO pin.
I have a script running in the background that takes care of turning off and on the amplifier, whit this line:
mpc status | grep playing > /dev/null

However, when I use airplay, the music player daemon is not used, and therefore the amp is turned off by the script.
Is there a similar command line interface to the airplay like the one above for mpc?
So it would something like this:
if [ mpc status | grep playing > /dev/null ] || [ airplay status | grep active ]; then
#set GPIO high
neophyte
 
Posts: 5
Joined: 09 Jun 2016, 07:30

Re: Airplay status commandline

Postby hondagx35 » 01 Aug 2016, 18:09

Hi neophyte,

i would use
Code: Select all
cat /proc/asound/card*/pcm*/sub*/status | grep state:

because this will work with all playback sources (mpd, airplay, UPnP and Spotify).

Frank
User avatar
hondagx35
 
Posts: 3042
Joined: 11 Sep 2014, 22:06
Location: Germany

Re: Airplay status commandline

Postby neophyte » 01 Aug 2016, 20:54

Thank you very much. That did the trick :)
neophyte
 
Posts: 5
Joined: 09 Jun 2016, 07:30

Re: Airplay status commandline

Postby fboe » 19 Aug 2017, 22:50

hondagx35 wrote:Hi neophyte,

i would use
Code: Select all
cat /proc/asound/card*/pcm*/sub*/status | grep state:

because this will work with all playback sources (mpd, airplay, UPnP and Spotify).

Frank


Hi neophyte and Frank

Will anyone of you share the script to control a relay?

Cheers
fboe
 
Posts: 27
Joined: 11 Mar 2016, 17:41
Location: Odense, Denmark

Re: Airplay status commandline

Postby rern » 20 Aug 2017, 02:03

fboe wrote:Will anyone of you share the script to control a relay?

How about this [Addon] RuneUI GPIO for power on / off audio equipments.
rAudio @ https://github.com/rern/rAudio-1
Raspberry Pi 4B
Raspberry Pi 3B > SMSL M8 DAC
Raspberry Pi Zero W
User avatar
rern
 
Posts: 723
Joined: 14 Jul 2016, 08:15

support RuneAudio Donate with PayPal


Return to Raspberry Pi

Who is online

Users browsing this forum: No registered users and 2 guests