diff options
author | Raymaekers Luca <raymaekers.luca@gmail.com> | 2023-04-07 01:25:43 +0200 |
---|---|---|
committer | Raymaekers Luca <raymaekers.luca@gmail.com> | 2023-04-07 01:28:26 +0200 |
commit | c7d083c6fa43f0c7e744cac2a05343777c6b717a (patch) | |
tree | 54c2771b63ee6e2fb697dc60ac5cc63f8a53f752 /bin/common | |
parent | 5abb1c661d529571e9e458a5b016ba419f8846d9 (diff) |
made dedicated serverscripts folder
Diffstat (limited to 'bin/common')
-rwxr-xr-x | bin/common/dladd | 51 |
1 files changed, 0 insertions, 51 deletions
diff --git a/bin/common/dladd b/bin/common/dladd deleted file mode 100755 index f46f4e4..0000000 --- a/bin/common/dladd +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/sh - -# Adds a torrent to deluge container -# Assumes there is a config folder where auth and torrents/ are located - -DLPATH="/srv/deluge/config" - -mkdir -p /tmp/dladd -LOG="/tmp/dladd/$(date +"%Y-%m-%d_%H-%M-%S").log" - -# Check for errors and input type -if [ $# -eq 0 ] -then - echo "No file name provided. Usage: $0 <file>" >&2 - exit 1 -elif [ -f "$1" ] -then - echo "is a file" - magnet=0 -elif echo "$1 " | grep -q "magnet:?xt=urn:btih:[a-zA-Z0-9]*" -then - echo "is a magnet link" - magnet=1 -else - echo "File '$1' not found." >&2 - exit 1 -fi - -password="$(cut -f2 -d: "$DLPATH/auth")" -if [ "$magnet" -eq 0 ] -then - file="$(date +"%Y-%m-%d_%H-%M-%S").torrent" - cp "$1" "$DLPATH/torrents/$file" - if docker exec -i deluge deluge-console "connect 127.0.0.1 localclient $password; add /config/torrents/$file" > "$LOG" 2>&1 - then - echo "torrent added!" - rm "$LOG" - else - echo "torrent couldn't be added, log at $LOG" - fi -else - link=$(echo -n "$1" | tr -d "'\"") - if docker exec -i deluge deluge-console "connect 127.0.0.1 localclient $password; add $link" > "$LOG" 2>&1 - then - echo "torrent added!" - rm "$LOG" - else - echo "torrent couldn't be added, log at $LOG" - fi -fi -rm -d /tmp/dladd 2>/dev/null |