mirror of
https://github.com/CoolnsX/repos_scripts.git
synced 2025-12-20 07:15:20 +05:30
feat : made scripts universal and much more complicated
This commit is contained in:
26
tor-bay
26
tor-bay
@@ -11,15 +11,27 @@ display() {
|
||||
wait
|
||||
}
|
||||
|
||||
[ -z "$*" ] && query=$(printf "" | bemenu --fn 'Roboto 15' -i -c -W 0.6 -B 3 -p "Search torrent: ") || query=$*
|
||||
case $(uname -o) in
|
||||
*ndroid*)
|
||||
os="droid"
|
||||
script_dir="$HOME"
|
||||
;;
|
||||
*)
|
||||
os="linux"
|
||||
script_dir="$HOME/repos_scripts"
|
||||
;;
|
||||
esac
|
||||
|
||||
. $script_dir/.functions
|
||||
[ -z "$*" ] && search_$os "Search Torrent: " || query=$*
|
||||
[ -z "$query" ] && exit 0
|
||||
tmp=$(notify-send "Searching query" -p)
|
||||
[ "$os" = "linux" ] && tmp=$(notify-send "Searching query" -p)
|
||||
query=$(printf "%s" "$query" | tr " " "+")
|
||||
data=$(curl -s "https://apibay.org/q.php?q=$query" | sed 's/},/}\n/g' | tr -d "[|]")
|
||||
notify-send "tidying up data" -r $tmp
|
||||
data=$(curl -s "https://apibay.org/q.php?q=$query" | sed 's/},/}\n/g' | tr -d "[]")
|
||||
[ "$os" = "linux" ] && notify-send "tidying up data" -r $tmp
|
||||
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')
|
||||
sel=$(display "$size" "$name_seed" | bemenu --fn 'Roboto 15' -i -c -W 0.6 -B 3 -l 25 -p "select torrent >" | cut -d" " -f3-)
|
||||
[ -z "$sel" ] && notify-send -u critical "No Torrent Selected" -r $tmp && exit 0 || notify-send "Selected $sel" -r $tmp
|
||||
sel=$(display "$size" "$name_seed" | menu_$os "Select Torrent: " | cut -d" " -f3-)
|
||||
[ -z "$sel" ] && exit 0
|
||||
magnet="magnet:?xt=urn:btih:$(printf "%s" "$data" | sed -nE 's/.*name":"(.*)","info_hash":"(.*)",.*leech.*/\2\t\1/p' | sed -n "s/\t$sel//p")"
|
||||
setsid -f $TERMINAL -e $HOME/repos_scripts/torrent "$magnet"
|
||||
torrent_$os "$magnet"
|
||||
|
||||
Reference in New Issue
Block a user