tubetop2: Check flags earlier on, adjust notification priorities
This commit is contained in:
parent
05fda57bf7
commit
becbd2b639
@ -29,18 +29,18 @@ function tubetop2-download {
|
||||
notify-high "Error" "An error occured while downloading $1. youtube-dl gave error code $errorcode." "dialog-error"
|
||||
return $errorcode
|
||||
fi
|
||||
notify-high "Download Finished" "\"$videoname\" is now ready to be embedded." "dialog-information"
|
||||
notify-normal "Download Finished" "\"$videoname\" is now ready to be embedded." "dialog-information"
|
||||
return 0
|
||||
}
|
||||
|
||||
function notify-normal {
|
||||
if [ -z ${1+x} ] || [ -z ${2+x} ] || [ -z ${3+x} ]; then return 1; fi
|
||||
notify-send -u low -t 3000 -i "$3" -a "$name" "$1" "$2"
|
||||
notify-send -u normal -t 3000 -i "$3" -a "$name" "$1" "$2"
|
||||
}
|
||||
|
||||
function notify-high {
|
||||
if [ -z ${1+x} ] || [ -z ${2+x} ] || [ -z ${3+x} ]; then return 1; fi
|
||||
notify-send -u normal -t 10000 -i "$3" -a "$name" "$1" "$2"
|
||||
notify-send -u high -t 10000 -i "$3" -a "$name" "$1" "$2"
|
||||
}
|
||||
|
||||
function log {
|
||||
@ -50,6 +50,19 @@ function log {
|
||||
|
||||
name="$(basename $0 .bash)"
|
||||
|
||||
# If we were called with --kill, kill all running tubetops
|
||||
if [ "$1" == "--kill" ]; then
|
||||
log 3 "Launched in kill mode. Killing xwinwrap"
|
||||
if pkill xwinwrap; then
|
||||
notify-normal "Stopped" "Stopped playing all embedded desktop videos" "user-trash"
|
||||
log 3 "Successfully killed xwinwrap"
|
||||
exit 0
|
||||
else
|
||||
log 0 "Could not find any instances of xwinwrap"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Figure out where to store the videos
|
||||
if [ -z ${XDG_DATA_HOME+x} ]; then
|
||||
cachedir="$HOME/.local/share/$name"
|
||||
@ -71,18 +84,6 @@ if ! [ -f "$cachedir/.symlink" ] && [ -d "$HOME/Videos" ]; then
|
||||
touch "$cachedir/.symlink"
|
||||
fi
|
||||
|
||||
# If we were called with --kill, kill all running tubetops
|
||||
if [ "$1" == "--kill" ]; then
|
||||
log 3 "Launched in kill mode. Killing xwinwrap"
|
||||
if pkill xwinwrap; then
|
||||
notify-high "Stopped" "Stopped playing all embedded desktop videos" "user-trash"
|
||||
exit 0
|
||||
else
|
||||
log 0 "Could not find any instances of xwinwrap"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Get a list of all the videos we have
|
||||
log 3 "Getting a list of videos"
|
||||
videos=$(find "$cachedir" -type f -name \*.mp4)
|
||||
|
Loading…
Reference in New Issue
Block a user