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:
@@ -24,7 +24,7 @@ torrent_linux() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
torrent_droid() {
|
torrent_droid() {
|
||||||
"$HOME/torrent" "$1"
|
"$HOME/.shortcuts/torrent" "$1"
|
||||||
}
|
}
|
||||||
|
|
||||||
info_droid() {
|
info_droid() {
|
||||||
|
|||||||
3
tor-bay
3
tor-bay
@@ -28,7 +28,8 @@ esac
|
|||||||
[ -z "$query" ] && exit 0
|
[ -z "$query" ] && exit 0
|
||||||
[ "$os" = "linux" ] && tmp=$(notify-send "Searching query" -p)
|
[ "$os" = "linux" ] && tmp=$(notify-send "Searching query" -p)
|
||||||
query=$(printf "%s" "$query" | tr " " "+")
|
query=$(printf "%s" "$query" | tr " " "+")
|
||||||
data=$(curl -s "https://apibay.org/q.php?q=$query" | sed 's/},/}\n/g' | tr -d "[]")
|
data=$(curl -s "https://apibay.org/q.php?q=$query" | tee data | sed 's/},/}\n/g' | tr -d "[]")
|
||||||
|
|
||||||
[ "$os" = "linux" ] && notify-send "tidying up data" -r $tmp
|
[ "$os" = "linux" ] && notify-send "tidying up data" -r $tmp
|
||||||
size=$(printf "%s" "$data" | sed -nE 's/.*name.*size":"(.*)",.*user.*/\1/p')
|
size=$(printf "%s" "$data" | sed -nE 's/.*name.*size":"(.*)",.*user.*/\1/p')
|
||||||
name_seed=$(printf "%s" "$data" | sed -nE 's/.*name":"(.*)","info_hash.*seeders":"(.*)",.*num.*/\2] \1/p')
|
name_seed=$(printf "%s" "$data" | sed -nE 's/.*name":"(.*)","info_hash.*seeders":"(.*)",.*num.*/\2] \1/p')
|
||||||
|
|||||||
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!!"
|
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
|
if [ "$(uname -o)" = "Android" ]; then
|
||||||
os="droid"
|
os="droid"
|
||||||
script_dir="$HOME/.shortcuts"
|
script_dir="$HOME/.shortcuts"
|
||||||
|
download_dir="/sdcard"
|
||||||
|
[ -z "$magnet" ] && magnet="$(termux-clipboard-get)"
|
||||||
else
|
else
|
||||||
os="linux"
|
os="linux"
|
||||||
script_dir="$HOME/repos_scripts"
|
script_dir="$HOME/repos_scripts"
|
||||||
|
download_dir="Downloads"
|
||||||
|
[ -z "$magnet" ] && magnet="$(wl-paste)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
#import generic functions
|
||||||
. $script_dir/.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
|
trap "rm -f $HOME/.cache/*.torrent;exit 0" INT HUP
|
||||||
[ -z "$*" ] && magnet="$(wl-paste)" || magnet="$*"
|
|
||||||
echo "$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_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:"
|
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"
|
aria2c --dir=$HOME/.cache --bt-metadata-only=true --bt-save-metadata=true "$magnet"
|
||||||
tput reset
|
tput reset
|
||||||
aria2c --show-files=true $HOME/.cache/*.torrent
|
aria2c --show-files=true $HOME/.cache/*.torrent
|
||||||
printf "Enter file idx(default=all):"
|
info_$os "Enter file idx(default=all):"
|
||||||
read -r ind
|
read -r ind
|
||||||
down "$HOME/.cache/*.torrent" "$ind"
|
down "$HOME/.cache/*.torrent" "$ind"
|
||||||
rm -f $HOME/.cache/*.torrent
|
rm -f $HOME/.cache/*.torrent
|
||||||
|
|||||||
Reference in New Issue
Block a user