summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Bruhin <me@the-compiler.org>2012-06-12 13:30:01 +0200
committerFlorian Bruhin <me@the-compiler.org>2012-06-12 13:30:01 +0200
commiteb8fc524deb04dd9096f951e15f2760d9094a8b1 (patch)
tree8eb52bdd758ff38a2e0ffcbb73fb3cf6f0fcecc2
parent131499ea8eacecc9feec319843654aa5b47e7254 (diff)
downloadquvi-dwb-eb8fc524deb04dd9096f951e15f2760d9094a8b1.tar.gz
quvi-dwb-eb8fc524deb04dd9096f951e15f2760d9094a8b1.zip
Sanity checks
-rwxr-xr-xquvi.sh23
1 files changed, 23 insertions, 0 deletions
diff --git a/quvi.sh b/quvi.sh
index 39af95c..bb5f5d0 100755
--- a/quvi.sh
+++ b/quvi.sh
@@ -22,6 +22,25 @@
# %h .. Media thumbnail URL
exec="mplayer %u"
+[[ -z "$DWB_FIFO" ]] && no_dwb=1
+which -q zenity || no_zenity=1
+which -q quvi || no_quvi=1
+
+if [[ "$no_dwb" && ("$no_zenity" || "$no_quvi") ]]; then
+ echo -n "Error: You don't run this script from dwb (or have an old dwb-"
+ echo "version) and you don't have Zenity or quvi installed!"
+ exit 1
+elif [[ "$no_zenity" ]]; then
+ echo "js window.alert('You need to have Zenity installed to run this script!');" >> "$DWB_FIFO"
+ exit 1
+elif [[ "$no_dwb" ]]; then
+ zenity --error --text "You don't run this script from dwb (or have an old dwb-version)!"
+ exit 1
+elif [[ "$no_quvi" ]]; then
+ echo "js window.alert('You need to have quvi installed to run this script!');" >> "$DWB_FIFO"
+ exit 1
+fi
+
formats=$(quvi -v quiet -F "$DWB_URI" 2>&1)
if [[ "$formats" == "error: no support"* ]]; then
@@ -40,3 +59,7 @@ else
fi
quvi -f "$format" --exec "$exec" -v mute "$DWB_URI"
+status=$?
+if [[ "$status" != 0 ]]; then
+ echo "js window.alert('quvi exited with nonzero status $status!');" >> "$DWB_FIFO"
+fi