This commit is contained in:
CoolnsX
2022-01-31 22:44:55 +05:30
parent 850394eed4
commit 12b79c4682
6 changed files with 34 additions and 22 deletions

30
torrent
View File

@@ -1,34 +1,52 @@
#!/bin/sh
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(){
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" || notify-send -u critical "Torrent:cheecha error!!"
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 index of the file to download:"
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" || notify-send -u critical "Torrent:cheecha error!!"
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
}
if [ -z "$*" ]; then
magnet="$(xclip -out clipboard)"
trap "rm -f $HOME/.cache/*.torrent;exit 0" INT HUP
file=$HOME/.cache/maglink
xclip -out clipboard > $file
if [ -f "$file" ]; then
magnet=$(cat $file)
else
magnet=$*
fi
echo "$magnet"
x=$(printf "MOVIES\\nSoftwares" | dmenu -p "Select Directory :" | tr -d '\n')
printf "Download>>>\n[f]ull torrent\n[p]artial torrent\n\tenter choice:"
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";;
p)
part_tor "$magnet" "$x";;
q)
break;;
esac