Files
repos_scripts/torrent
CoolnsX 12b79c4682 update
2022-01-31 22:44:55 +05:30

53 lines
1.4 KiB
Bash
Executable File

#!/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" && 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
}
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 "${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