QuickFix.

This commit is contained in:
coolnsx
2022-11-08 11:29:57 +05:30
parent 03ecdcddb9
commit fb7a16f018
5 changed files with 11 additions and 23 deletions

View File

@@ -11,7 +11,7 @@ display() {
wait
}
[ -z "$*" ] && printf "Search torrent:" && query=$(printf "" | dmenu -p "Search torrent: ") || query=$*
[ -z "$*" ] && query=$(printf "" | bemenu --fn 'Roboto 15' -i -c -W 0.6 -B 3 -p "Search torrent: ") || query=$*
[ -z "$query" ] && exit 0
tmp=$(notify-send "Searching query" -p)
query=$(printf "%s" "$query" | tr " " "+")
@@ -19,7 +19,7 @@ data=$(curl -s "https://apibay.org/q.php?q=$query" | sed 's/},/}\n/g' | tr -d "[
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" | dmenu -l 25 -p "select torrent >" | cut -d" " -f3-)
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
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 st -e $HOME/repos_scripts/torrent "$magnet"
setsid -f foot -e $HOME/repos_scripts/torrent "$magnet"