summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Olson <polson136@gmail.com>2013-07-27 17:06:03 -0500
committerLars-Dominik Braun <lars@6xq.net>2013-07-30 16:32:04 +0200
commit36ea2f13f87b9310219790c3cee498201d54f8e0 (patch)
treed17d9828c6891dcceb42e6fafd75e9882f07a58d
parentbacc60b7a8e7854ca14b5a5f65429500831f20cb (diff)
downloadpianobar-36ea2f13f87b9310219790c3cee498201d54f8e0.tar.gz
pianobar-36ea2f13f87b9310219790c3cee498201d54f8e0.tar.bz2
pianobar-36ea2f13f87b9310219790c3cee498201d54f8e0.zip
Added support for EOF and ^D and environment variables to headless_pianobar
Closes #382.
-rwxr-xr-xcontrib/headless_pianobar9
1 files changed, 6 insertions, 3 deletions
diff --git a/contrib/headless_pianobar b/contrib/headless_pianobar
index b9483c9..20f8a54 100755
--- a/contrib/headless_pianobar
+++ b/contrib/headless_pianobar
@@ -59,11 +59,11 @@
# This script regularly checks whether or not pianobar is running in the
# background in order to detect when it closes. This variable sets how long of
# a delay there will be between checks (in seconds).
-CHECK_PERIOD="1"
+CHECK_PERIOD=${CHECK_PERIOD:-"1"}
# This variable will set how many lines of pianobar's output to print when
# re-connecting to pianobar.
-OUTPUT_LINES="30"
+OUTPUT_LINES=${OUTPUT_LINES:-"30"}
# Ensure the ctrl fifo exists.
if [ ! -p $HOME/.config/pianobar/ctl ]
@@ -151,7 +151,10 @@ IFS=""
while /bin/true
do
read -n1 -s INPUT
- if [ "$INPUT" == "" ]
+ if [[ $? == "1" || "$INPUT" == $'\004' ]]
+ then
+ quit
+ elif [ "$INPUT" == "" ]
then
echo "" > $HOME/.config/pianobar/ctl
else