aboutsummarylogtreecommitdiffstats
path: root/addmag
diff options
context:
space:
mode:
authoraetherised2021-11-09 15:20:33 -0500
committeraetherised2021-11-09 15:20:33 -0500
commit40eba8c25b35dad1154a842c38e1db292b08605d (patch)
treed8e3dfce5c8fc33d9376b88f0f0fe541979a33f3 /addmag
parent73f768a0f85e95a06804cf0eb6d1b4c1a0a2d373 (diff)
downloadaur-40eba8c25b35dad1154a842c38e1db292b08605d.tar.gz
tweak notifications
Diffstat (limited to 'addmag')
-rwxr-xr-xaddmag12
1 files changed, 6 insertions, 6 deletions
diff --git a/addmag b/addmag
index 90876beb890d..165c7d73cd65 100755
--- a/addmag
+++ b/addmag
@@ -16,6 +16,10 @@ USRRC="${HOME}/.${RCNAME}"
ADDR=
NOTIFY=
+notify() {
+ [[ -n "${NOTIFY}" ]] && notify-send "${@}"
+}
+
while getopts 'n' arg; do
case "${arg}" in
n) NOTIFY="true" ;;
@@ -27,10 +31,6 @@ shift $((OPTIND - 1))
LINK="${1}"
-notify() {
- notify-send "${@}" || echo "notification failed"
-}
-
if [[ -z "${LINK}" ]]; then
echo "ERROR: no magnet link or torrent file specified"
exit 1
@@ -48,9 +48,9 @@ fi
if transmission-remote "${ADDR}" -a "${LINK}"; then
echo "added '${LINK}' to '${ADDR}'"
- [[ -n "${NOTIFY}" ]] && notify -u normal -t 5000 "TORRENT ADDED" "Added torrent to '${ADDR}'"
+ notify -u normal -t 5000 "TORRENT ADDED" "Added torrent to '${ADDR}'"
else
echo "ERROR: failed to add '${LINK}' to '${ADDR}'"
- [[ -n "${NOTIFY}" ]] && notify -u critical -t 5000 "TORRENT ADD FAILED" "Failed to add torrent to '${ADDR}'"
+ notify -u critical -t 5000 "TORRENT ADD FAILED" "Failed to add torrent to '${ADDR}'"
fi