sane-scripts: add sane-bt-add to download some torrent
This commit is contained in:
parent
4331df28d2
commit
bf64948cc1
41
pkgs/sane-scripts/src/sane-bt-add
Executable file
41
pkgs/sane-scripts/src/sane-bt-add
Executable file
|
@ -0,0 +1,41 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
endpoint=https://bt.uninsane.org/transmission/rpc
|
||||||
|
PASS=$(sudo cat /run/secrets/transmission_passwd)
|
||||||
|
|
||||||
|
options=$(getopt -l film,prefix: -- "" "${@}")
|
||||||
|
eval "set -- ${options}"
|
||||||
|
|
||||||
|
prefix=
|
||||||
|
while true; do
|
||||||
|
case "$1" in
|
||||||
|
(--prefix)
|
||||||
|
shift
|
||||||
|
prefix="$1"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
(--film)
|
||||||
|
prefix=Videos/Film/
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
(--)
|
||||||
|
shift
|
||||||
|
if [ $# -eq 1 ]; then
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
(*)
|
||||||
|
echo "invalid arguments"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
# positional ("non-option") parameters
|
||||||
|
torrent="$1"
|
||||||
|
|
||||||
|
transmission-remote "$endpoint" \
|
||||||
|
--auth "colin:$PASS" \
|
||||||
|
--download-dir "/var/lib/uninsane/media/$prefix" \
|
||||||
|
--add "$torrent"
|
Loading…
Reference in New Issue
Block a user