determing the status (play / don't play) of awn radio applet in bash

Asked by Axel Pospischil

Hi Bryan,

first of all thanks for your great work in awn which i appreciate
much ;)

I am using your awn radio applet (0.4.1) in ubuntu 10.04 at my mythtv
music box machine. There is a batch script triggering the shutdown of
the machine if certain programs are running or not.

Can you help me finding a way to determine the status (playing / not
playing) of the radio applet in a bash shell.

Neither "pactl stat | list" nor "ps x" give me appropriate informations
about the status. I also don't find any logfile or anything ...

Thank you very much for your time.
Probably you could enable the "answers" section in launchpad so we could
post the solution there ;)

Many thankful greets
Axel

Question information

Language:
English Edit question
Status:
Solved
For:
AWN Radio Player Edit question
Assignee:
No assignee Edit question
Solved by:
Axel Pospischil
Solved:
Last query:
Last reply:
Revision history for this message
Bryan Blunt (bryan-blunt) said :
#1

There's no way of doing this that I'm aware of. Do you have a way you'd like to do it?

Revision history for this message
Axel Pospischil (apos) said :
#2

Possible ways I could imagine: The point is, that awn could run in every desktop environment you can imagine, so there should be a way of keeping track of the status independent of this (not gconf).

So how about a file containing the status in e.g.
   ~/.config/awn/applets/radio/status

   status={playing|stopped}
   station={string of actual radiostation playing}

might be a good place.

Should be not very difficult to implement ;)

Other ideas.

Revision history for this message
Bryan Blunt (bryan-blunt) said :
#3

You're right, it wasn't difficult to implement :) New version uploaded, let me know if it does what you wanted.

Revision history for this message
Bryan Blunt (bryan-blunt) said :
#4

Note that from v0.7 onwards, there is also a "recording" status.

Revision history for this message
Axel Pospischil (apos) said :
#5

Thank you very much. This is exactly what I needed. It works as expected.

A simple
   cat status | grep status | cut -d"=" -f2
now gives the status of the program with which I can trigger my automatic shutdown script for mythtv box.

There is only one little drawback , which is not really a problem for me, but might be for others: If you log out of gnome, mplayer keeps playing in the background. After re-login It also is not possible to end the former process via the applet. Probably you should also save the according mplayer PID's in the status file and use it for killing processes if the program unexpectingly stops.

So long THX very much ;)