diff options
author | aetherised | 2021-05-11 02:31:18 -0400 |
---|---|---|
committer | aetherised | 2021-05-11 02:31:18 -0400 |
commit | 47f001bfb2af09cbaa1e3077a1971a3d61ccd066 (patch) | |
tree | fd2b32cfed9333d8fe3cea9dfcfc46527863292e /addmag | |
download | aur-47f001bfb2af09cbaa1e3077a1971a3d61ccd066.tar.gz |
init
Diffstat (limited to 'addmag')
-rwxr-xr-x | addmag | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/addmag b/addmag new file mode 100755 index 000000000000..13fe60d453c7 --- /dev/null +++ b/addmag @@ -0,0 +1,35 @@ +#!/bin/bash +# +# USAGE: addmag LINK +# Opens magnet links with a remote transmission daemon. +# The remote address is configured in either: +# /etc/addmagrc +# ${HOME}/.addmagrc +# These files should contain nothing but the remote address. +# +# aetherised 2021 <aetherised@gmail.com> +# + +RCNAME="addmagrc" +SYSRC="/etc/${RCNAME}" +USRRC="${HOME}/.${RCNAME}" + +LINK="${1}" +ADDR= + +if [[ -z "${LINK}" ]]; then + echo "ERROR: no magnet link or torrent file specified" + exit 1 +fi + +[[ -f "${SYSRC}" ]] && ADDR=$(cat "${SYSRC}") +[[ -f "${USRRC}" ]] && ADDR=$(cat "${USRRC}") +if [[ -z "${ADDR}" ]]; then + echo "ERROR: no remote address configured" + echo " Place the address of the remote daemon in one of these locations:" + echo " ${SYSRC}" + echo " ${USRRC}" + exit 1 +fi + +transmission-remote "${ADDR}" -a "${LINK}" |