diff options
-rwxr-xr-x | 1337x | 11 | ||||
-rwxr-xr-x | yts | 13 |
2 files changed, 15 insertions, 9 deletions
@@ -2,6 +2,7 @@ url_1337x="https://1337x.to" proxy_1337x="https://1337x.torrentbay.to" +menu="dmenu" die() { @@ -58,23 +59,25 @@ main() out= query= - dep_check "dmenu" - + [ -z "$DISPLAY" ] && + menu="bemenu" if [ "$#" -gt 0 ] && [ "$1" = "-o" ] then out=true shift fi + dep_check "$menu" + curl -Is "$url_1337x" > /dev/null || url_1337x="$proxy_1337x" - query="${*:-$(printf "" | dmenu -p " ")}" + query="${*:-$(printf "" | "$menu" -p " ")}" [ -z "$query" ] && die "please enter a query" fetch="$(search_1337x "$query")" - select="$(echo "$fetch" | sed -e's/^.*\///g' | tr '-' ' ' | dmenu -l 25 -p " " | tr ' ' '-')" + select="$(echo "$fetch" | sed -e's/^.*\///g' | tr '-' ' ' | "$menu" -l 25 -p " " | tr ' ' '-')" magnet="$(magnet_1337x "$(echo "$fetch" | grep "$select")")" [ -z "$magnet" ] && @@ -2,6 +2,7 @@ url_yts="https://yts.mx" proxy_yts="https://yts.torrentbay.to" +menu="dmenu" die() { @@ -50,7 +51,7 @@ dllink_yts() id= fetch="$(get_yts "movies/$1" | grep -Eo "value=\"[A-Z0-9]{40}\">[a-zA-Z0-9 ]*")" - select="$(echo "$fetch" | cut -d'>' -f2 | dmenu -l 25 -p " ")" + select="$(echo "$fetch" | cut -d'>' -f2 | "$menu" -l 25 -p " ")" [ -z "$select" ] && die "please select a quality" id="$(echo "$fetch" | grep "$select" | cut -d'"' -f2)" @@ -68,15 +69,17 @@ main() out= query= - dep_check "dmenu" - + [ -z "$DISPLAY" ] && + menu="bemenu" if [ "$#" -gt 0 ] && [ "$1" = "-o" ] then out=true shift fi - query="${*:-$(printf "" | dmenu -p " ")}" + dep_check "$menu" + + query="${*:-$(printf "" | "$menu" -p " ")}" [ -z "$query" ] && die "please enter a query" @@ -84,7 +87,7 @@ main() url_yts="$proxy_yts" fetch="$(search_yts "$query")" - dllink="$(dllink_yts "$(echo "$fetch" | tr '-' ' ' | dmenu -l 25 -p " " | tr ' ' '-')")" + dllink="$(dllink_yts "$(echo "$fetch" | tr '-' ' ' | "$menu" -l 25 -p " " | tr ' ' '-')")" [ -z "$dllink" ] && die "empty magnet" |