Compare commits

..

3 Commits

3 changed files with 26 additions and 14 deletions

View File

@ -6,6 +6,6 @@
[ "$1" = "open" ] && buku --nostdin -p -f5 | sed 's/\t/;/g' | column -t -s ';' | $DMENU -p "Open bookmark: " -i -l 10 | cut -d' ' -f1 | xargs -r buku --nostdin -o [ "$1" = "open" ] && buku --nostdin -p -f5 | sed 's/\t/;/g' | column -t -s ';' | $DMENU -p "Open bookmark: " -i -l 10 | cut -d' ' -f1 | xargs -r buku --nostdin -o
[ "$1" = "edit" ] && buku --nostdin -p -f5 | sed 's/\t/;/g' | column -t -s ';' | $DMENU -p "Edit bookmark: " -i -l 10 | cut -d' ' -f1 | xargs -r $TERMINAL start -- buku -w [ "$1" = "edit" ] && buku --nostdin -p -f5 | sed 's/\t/;/g' | column -t -s ';' | $DMENU -p "Edit bookmark: " -i -l 10 | cut -d' ' -f1 | xargs -r $TERMINAL -e buku -w
[ "$1" = "delete" ] && buku --nostdin -p -f5 | sed 's/\t/;/g' | column -t -s ';' | $DMENU -p "Edit bookmark: " -i -l 10 | cut -d' ' -f1 | xargs -r -I % buku --nostdin -d % --tacit && notify-send "Deleted bookmark" [ "$1" = "delete" ] && buku --nostdin -p -f5 | sed 's/\t/;/g' | column -t -s ';' | $DMENU -p "Edit bookmark: " -i -l 10 | cut -d' ' -f1 | xargs -r -I % buku --nostdin -d % --tacit && notify-send "Deleted bookmark"

View File

@ -21,7 +21,9 @@ menu () {
main () { main () {
load_config load_config
menu $@ [ $# -eq 0 ] && link=$(xclip -sel c -o) || link="$@"
menu $link
} }
main $@ main $@

View File

@ -20,14 +20,19 @@ list() {
done | column -t -s '|' | dmenu -i -l 15 | awk '{print $1}' done | column -t -s '|' | dmenu -i -l 15 | awk '{print $1}'
} }
query=$(printf '%s' | dmenu -i -p "Enter search term: " | sed 's/ /%20/g')
base_url="https://torrentapi.org/pubapi_v2.php?" base_url="https://torrentapi.org/pubapi_v2.php?"
token=$(curl -sLH "User-agent: 'your bot 0.1'" "${base_url}get_token=get_token&app_id=pirokit" | jq -r '.token') token=$(curl -sLH "User-agent: 'your bot 0.1'" "${base_url}get_token=get_token&app_id=dmenu-rarbg" | jq -r '.token')
default_args="&token=${token}&limit=100&app_id=pirokit&format=json_extended" while [ "$token" = "" ]; do
token=$(curl -sLH "User-agent: 'your bot 0.1'" "${base_url}get_token=get_token&app_id=dmenu-rarbg" | jq -r '.token')
notify-send "RARGB" "Waiting 5 second for api limit to reset"
sleep 5
done
default_args="&token=${token}&limit=100&app_id=dmenu-rarbg&format=json_extended"
query=$(printf '%s' | dmenu -i -p "Enter search term: " | sed 's/ /%20/g')
if [ "$query" = "" ]; then if [ "$query" = "" ]; then
url="${base_url}mode=list${default_args}" url="${base_url}mode=list${default_args}"
@ -36,19 +41,24 @@ else
fi fi
case "$(printf "All\\nMovies\\nTV Shows\\nGames\\nMusic" | dmenu -i -p "Choose category: ")" in case "$(printf "All\\nMovies\\nTV Shows\\nGames\\nMusic" | dmenu -i -p "Choose category: ")" in
All) response=$(curl -sLH "User-agent: 'your bot 0.1'" "${url}");; All) url="$url";;
Movies) response=$(curl -sLH "User-agent: 'your bot 0.1'" "${url}&category=17;44;45;47;50;51;52;42;46;54");; Movies) url="${url}&category=17;44;45;47;50;51;52;42;46;54";;
"TV Shows") response=$(curl -sLH "User-agent: 'your bot 0.1'" "${url}&category=2;18;41;49");; "TV Shows") url="${url}&category=2;18;41;49";;
Games) response=$(curl -sLH "User-agent: 'your bot 0.1'" "${url}&category=2;27;28;29;30;31;53");; Games) url="${url}&category=2;27;28;29;30;31;53";;
Music) response=$(curl -sLH "User-agent: 'your bot 0.1'" "${url}&category=2;23;24;25;26");; Music) url="${url}&category=2;23;24;25;26";;
esac esac
response=$(curl -sLH "User-agent: 'your bot 0.1'" "${url}" )
while [ "$response" = "" ]; do
response=$(curl -sLH "User-agent: 'your bot 0.1'" "${url}" )
notify-send "RARGB" "Waiting 5 second for api limit to reset"
sleep 5
done
[ "$response" = "" ] && notify-send "RARBG" "Wait for 3 seconds for api to work." && exit 1 [ "$response" = "" ] && notify-send "RARBG" "Wait for 3 seconds for api to work." && exit 1
[ "$response" = '{"error":"No results found","error_code":20}' ] && notify-send "RARBG" "No results found" && exit 1 [ "$response" = '{"error":"No results found","error_code":20}' ] && notify-send "RARBG" "No results found" && exit 1
# echo "$response" | jq '.'
# exit 1
titles=$(printf '%s\n' "$response" | jq -r '.[] | .[].title') titles=$(printf '%s\n' "$response" | jq -r '.[] | .[].title')
seeders=$(printf '%s\n' "$response" | jq -r '.[] | .[].seeders') seeders=$(printf '%s\n' "$response" | jq -r '.[] | .[].seeders')