mirror of
https://github.com/CoolnsX/repos_scripts.git
synced 2025-12-20 07:15:20 +05:30
pay no attention to the man behind the curtain
This commit is contained in:
12
torrent
12
torrent
@@ -12,17 +12,25 @@ down() {
|
||||
aria2c --file-allocation=trunc -d Softwares --select-file=$2 --seed-time=0 $1 && info_$os "Torrent: Download complete" && rm -f $file || error_$os "Torrent: Error!!"
|
||||
}
|
||||
|
||||
magnet="$*"
|
||||
if [ "$(uname -o)" = "Android" ]; then
|
||||
os="droid"
|
||||
script_dir="$HOME/.shortcuts"
|
||||
download_dir="/sdcard"
|
||||
[ -z "$magnet" ] && magnet="$(termux-clipboard-get)"
|
||||
else
|
||||
os="linux"
|
||||
script_dir="$HOME/repos_scripts"
|
||||
download_dir="Downloads"
|
||||
[ -z "$magnet" ] && magnet="$(wl-paste)"
|
||||
fi
|
||||
|
||||
#import generic functions
|
||||
. $script_dir/.functions
|
||||
|
||||
#check if the url is magnet
|
||||
! printf "%s" "$magnet" | grep -q "magnet:" && error_$os "Not a valid magnet link!" && exit 0
|
||||
trap "rm -f $HOME/.cache/*.torrent;exit 0" INT HUP
|
||||
[ -z "$*" ] && magnet="$(wl-paste)" || magnet="$*"
|
||||
echo "$magnet"
|
||||
printf "${c_yellow}Download>>\n${c_green}[f]ull torrent\n${c_cyan}[p]artial torrent \n${c_red}[q]uit"
|
||||
printf "${c_reset}\n\tenter choice:"
|
||||
@@ -35,7 +43,7 @@ case $ch in
|
||||
aria2c --dir=$HOME/.cache --bt-metadata-only=true --bt-save-metadata=true "$magnet"
|
||||
tput reset
|
||||
aria2c --show-files=true $HOME/.cache/*.torrent
|
||||
printf "Enter file idx(default=all):"
|
||||
info_$os "Enter file idx(default=all):"
|
||||
read -r ind
|
||||
down "$HOME/.cache/*.torrent" "$ind"
|
||||
rm -f $HOME/.cache/*.torrent
|
||||
|
||||
Reference in New Issue
Block a user