You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Bear with me, Im not much of a programmer. I have been writing a script, fine tuning it through a mountain of trial and error, and I remain confused as to how to code it to get the right returns in the command line when running the script. It is supposed to return the status of my radiotray app, whther its running, playing, or not running.
Here is the code.
#!/bin/bash
now=$( date "+%a, %e %b, %H:%M:%S" )
app="radiotray-ng"
procbin="application.process.binary"
appid=$( ps -aux | grep -i "$app" | awk '{print $2}' )
playing=$(pacmd list-sink-inputs | grep "$procbin" | grep "$app" | cut -d '"' -f2)
$playing
if [[ $playing = $app ]]; then
echo "$now RadioTray Is Playing"
else
echo "$now Playing RadioTray"
/$HOME/.config/radiotray-ng/rtng-dbus play
fi
if ps -p $appid > /dev/null; then
echo "$now RadioTray Is Running, pid $appid"
echo "Not starting another instance."
else
echo "$now RadioTray Is Launching"
/usr/bin/radiotray-ng --play
/$HOME/.config/radiotray-ng/rtng-dbus play
fi
exit
This is what I get when it's playing:
An instance of radiotray-ng is already running, pid: 62507 Fri, 15 Sep, 01:20:30 RadioTray Is Playing Fri, 15 Sep, 01:20:30 RadioTray Is Running, pid 62507 66413 Not starting another instance.
Not playing but still running (launched):
Fri, 15 Sep, 01:20:45 Playing RadioTray Fri, 15 Sep, 01:20:45 RadioTray Is Running, pid 62507 66440 Not starting another instance.
And not running at all: Fri, 15 Sep, 01:21:00 Playing RadioTray Error org.freedesktop.DBus.Error.ServiceUnknown: The name com.github.radiotray_ng was not provided by any .service files Fri, 15 Sep, 01:21:00 RadioTray Is Launching
Where it hangs until I exit the app, then returns this: Error org.freedesktop.DBus.Error.ServiceUnknown: The name com.github.radiotray_ng was not provided by any .service files
I would like it to return the status of the player (not running, running but not playing, or playing), and exit cleanly. Every time, if at all possible.
The text was updated successfully, but these errors were encountered:
Bear with me, Im not much of a programmer. I have been writing a script, fine tuning it through a mountain of trial and error, and I remain confused as to how to code it to get the right returns in the command line when running the script. It is supposed to return the status of my radiotray app, whther its running, playing, or not running.
Here is the code.
This is what I get when it's playing:
An instance of radiotray-ng is already running, pid: 62507 Fri, 15 Sep, 01:20:30 RadioTray Is Playing Fri, 15 Sep, 01:20:30 RadioTray Is Running, pid 62507 66413 Not starting another instance.
Not playing but still running (launched):
Fri, 15 Sep, 01:20:45 Playing RadioTray Fri, 15 Sep, 01:20:45 RadioTray Is Running, pid 62507 66440 Not starting another instance.
And not running at all:
Fri, 15 Sep, 01:21:00 Playing RadioTray Error org.freedesktop.DBus.Error.ServiceUnknown: The name com.github.radiotray_ng was not provided by any .service files Fri, 15 Sep, 01:21:00 RadioTray Is Launching
Where it hangs until I exit the app, then returns this:
Error org.freedesktop.DBus.Error.ServiceUnknown: The name com.github.radiotray_ng was not provided by any .service files
I would like it to return the status of the player (not running, running but not playing, or playing), and exit cleanly. Every time, if at all possible.
The text was updated successfully, but these errors were encountered: