From d141a7e0ac50093fb5f9eea718901487a994d58f Mon Sep 17 00:00:00 2001 From: Darren Cheng Date: Fri, 1 Nov 2024 13:27:21 -0700 Subject: [PATCH] Allow host specification in `tor`. --- bin/tor | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/bin/tor b/bin/tor index 0bbebe6..3e1f66e 100755 --- a/bin/tor +++ b/bin/tor @@ -3,7 +3,7 @@ # Upload to acorn host if [[ - "$#" -ne 1 || ( + "$#" -lt 1 || ( "$1" != "movies-4k" && "$1" != "tv-4k" && "$1" != "books" && @@ -15,7 +15,7 @@ if [[ "$1" != "safe" && "$1" != "tv" ) ]]; then - echo "Usage: tor [movies/tv/safe/misc/hole/books/manga/movies-4k/tv-4k/music]" + echo "Usage: tor [movies|tv|safe|misc|hole|books|manga|movies-4k|tv-4k|music] (briareus|ananke)" exit 1 fi @@ -27,19 +27,24 @@ if [ "$target" = "books" ]; then target="audiobooks" fi +host="$ACORN_HOST" +if [[ "$2" = "ananke" || "$target" = "safe" ]]; then + host="$ACORN2_HOST" +fi + cd ~/Downloads || exit 1 shopt -s nullglob torrents=(*.torrent) if [ ${#torrents[@]} -eq 0 ]; then echo -e "\033[00;31mNo torrents found\033[0m" else - host="$ACORN_USERNAME@$ACORN_HOST" + address="$ACORN_USERNAME@$host" if [ "$target" = "safe" ]; then - host="$ACORN_USERNAME@$ACORN2_HOST" + address="$ACORN_USERNAME@$host" fi destination="./downloads/torrents/$target" for torrent in "${torrents[@]}"; do echo -e "\033[00;34mUploading $torrent\033[0m" - scp "$torrent" "$host:$destination" && rm "$torrent" + scp "$torrent" "$address:$destination" && rm "$torrent" done fi