Skip to content

Commit

Permalink
Allow host specification in tor.
Browse files Browse the repository at this point in the history
  • Loading branch information
drn committed Nov 1, 2024
1 parent 5da0a5b commit d141a7e
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions bin/tor
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Upload to acorn host

if [[
"$#" -ne 1 || (
"$#" -lt 1 || (
"$1" != "movies-4k" &&
"$1" != "tv-4k" &&
"$1" != "books" &&
Expand All @@ -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

Expand All @@ -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

0 comments on commit d141a7e

Please sign in to comment.