add new script and some optimizations

This commit is contained in:
CoolnsX
2022-02-19 15:22:26 +05:30
parent 8118953030
commit 0e9dfc1577
4 changed files with 57 additions and 69 deletions

33
torrent
View File

@@ -3,28 +3,13 @@
c_red="\033[1;31m"
c_green="\033[1;32m"
c_yellow="\033[1;33m"
c_blue="\033[1;34m"
c_magenta="\033[1;35m"
c_cyan="\033[1;36m"
c_reset="\033[0m"
full_tor(){
down(){
tput reset
notify-send "Torrent:Rukk ja cheecha Download ho rha hai"
aria2c -d $2 --seed-time=0 "$1" && notify-send "Torrent:cheecha download hogyi" && rm -f $file || notify-send -u critical "Torrent:cheecha error!!"
}
part_tor(){
aria2c --dir=$HOME/.cache --bt-metadata-only=true --bt-save-metadata=true "$1"
tput reset
aria2c --show-files=true $HOME/.cache/*.torrent
printf "Enter file idx(default=all):"
read -r ind
tput reset
notify-send "Torrent:Rukk ja cheecha Download ho rha hai"
aria2c --select-file=$ind -d $2 --seed-time=0 $HOME/.cache/*.torrent && notify-send "Torrent:cheecha download hogyi" && rm -f $file || notify-send -u critical "Torrent:cheecha error!!"
rm -f $HOME/.cache/*.torrent
notify-send "Torrent: Downloading"
aria2c -d $2 --select-file=$3 --seed-time=0 $1 && notify-send "Torrent: Download complete" && rm -f $file || notify-send -u critical "Torrent: Error!!"
}
trap "rm -f $HOME/.cache/*.torrent;exit 0" INT HUP
@@ -36,15 +21,21 @@ else
fi
echo "$magnet"
x=$(printf "MOVIES\\nSoftwares" | dmenu -p "Select Directory :" | tr -d '\n')
x=$(printf "MOVIES\nSoftwares" | dmenu -p "Select Directory :" | tr -d '\n')
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:"
read -r ch
case $ch in
f)
full_tor "$magnet" "$x";;
down "$magnet" "$x";;
p)
part_tor "$magnet" "$x";;
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):"
read -r ind
down "$HOME/.cache/*.torrent" "$x" "$ind"
rm -f $HOME/.cache/*.torrent;;
q)
break;;
esac