torwrap: refactor
This commit is contained in:
parent
c5118a7092
commit
402f1937bf
|
@ -4,18 +4,20 @@ check () { \
|
|||
! pidof transmission-daemon >/dev/null && transmission-daemon && notify-send "transmission daemon enabled."
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
toggle)
|
||||
if pidof transmission-daemon >/dev/null ;
|
||||
then
|
||||
prompt "Turn off transmission-daemon?" "pkill transmission-da" && notify-send "transmission-daemon disabled."
|
||||
else
|
||||
prompt "Turn on transmission-daemon?" "transmission-daemon" && notify-send "transmission-daemon enabled."
|
||||
fi ;;
|
||||
open)
|
||||
check ; $TERMINAL tremc ;;
|
||||
add)
|
||||
check ; sleep 1 && transmission-remote -a "$2" && notify-send "Torrent added." ;;
|
||||
*)
|
||||
notify-send "$TR_TORRENT_NAME downloaded." && sleep 60 && transmission-remote -t ${TR_TORRENT_ID} -r
|
||||
esac
|
||||
while getopts 'toar' OPTION; do
|
||||
case "$OPTION" in
|
||||
t)
|
||||
if pidof transmission-daemon >/dev/null ;
|
||||
then
|
||||
prompt "Turn off transmission-daemon?" "pkill transmission-da" && notify-send "transmission-daemon disabled."
|
||||
else
|
||||
prompt "Turn on transmission-daemon?" "transmission-daemon" && notify-send "transmission-daemon enabled."
|
||||
fi ;;
|
||||
o)
|
||||
check ; $TERMINAL tremc ;;
|
||||
a)
|
||||
check ; sleep 1 && transmission-remote -a "$2" && notify-send "Torrent added." ;;
|
||||
r)
|
||||
notify-send "$TR_TORRENT_NAME downloaded." && sleep 60 && transmission-remote -t ${TR_TORRENT_ID} -r
|
||||
esac
|
||||
done
|
||||
|
|
Loading…
Reference in New Issue