Generic update.
This commit is contained in:
parent
15ecb794d7
commit
1c0a265455
@ -8,4 +8,4 @@
|
||||
|
||||
[ "$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" = "delete" ] && buku --nostdin -p -f5 | sed 's/\t/;/g' | column -t -s ';' | $DMENU -p "Edit bookmark: " -i -l 10 | cut -d' ' -f1 | xargs -r buku --nostdin -d --tacit
|
||||
[ "$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"
|
||||
|
10
dmenu-games
10
dmenu-games
@ -14,15 +14,9 @@ get_category () {
|
||||
menu () {
|
||||
while [ -z "$game" ]
|
||||
do
|
||||
[ -z "$1" ] && game=$(game-run list "$category" | sed '/-18+/d' | $DMENU -p "Choose game to run:")
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
game=$(game-run list "$category" | sed '/-18+/d' | $DMENU -p "Choose game to run:")
|
||||
elif [ "$1" = "-a" ]; then
|
||||
game=$(game-run list "$category" | $DMENU -p "Choose game to run:")
|
||||
else
|
||||
printf '%s\n' "Option $1 doesn't exit!!"
|
||||
exit 1
|
||||
fi
|
||||
[ "$1" = "-a" ] && game=$(game-run list "$category" | $DMENU -p "Choose game to run:")
|
||||
|
||||
[ -z "$game" ] && get_category
|
||||
done
|
||||
|
@ -1,10 +1,16 @@
|
||||
#!/bin/env bash
|
||||
#!/bin/sh
|
||||
|
||||
# script to run a menu prompt when having more than 2 players since
|
||||
# playerctl is bad at managing more than one player at the same time
|
||||
|
||||
load_config () {
|
||||
source $HOME/.config/dmenu/config
|
||||
. $HOME/.config/dmenu/config
|
||||
}
|
||||
|
||||
menu () {
|
||||
choice=$(playerctl -l | $DMENU -p 'Manage:')
|
||||
[ -z "$choice" ] && exit
|
||||
playerctl -p $choice $1
|
||||
}
|
||||
|
||||
main () {
|
||||
@ -14,15 +20,9 @@ main () {
|
||||
[ -z "$command" ] && exit
|
||||
instances=$(playerctl -l | wc -l)
|
||||
|
||||
if [ "$instances" = "0" ]; then
|
||||
exit
|
||||
elif [ "$instances" -lt "2" ]; then
|
||||
playerctl $command
|
||||
else
|
||||
choice=$(playerctl -l | $DMENU -p 'Manage:')
|
||||
[ -z "$choice" ] && exit
|
||||
playerctl -p $choice $command
|
||||
fi
|
||||
[ "$instances" = "0" ] && exit
|
||||
|
||||
[ "$instances" -lt "2" ] && playerctl $command || menu $command
|
||||
}
|
||||
|
||||
main $@
|
||||
|
69
dmenu-rarbg
Executable file
69
dmenu-rarbg
Executable file
@ -0,0 +1,69 @@
|
||||
#!/bin/sh
|
||||
|
||||
convert_sizes () {
|
||||
printf '%s\n' "$@" | \
|
||||
while read size; do
|
||||
numfmt --to iec --format "%.2f" $size
|
||||
done
|
||||
}
|
||||
|
||||
list() {
|
||||
num=1
|
||||
printf '%s\n' "$1" | \
|
||||
while read line in; do
|
||||
category=$(printf '%s' "$2" | sed -n "${num}p")
|
||||
seeder=$(printf '%s' "$3" | sed -n "${num}p")
|
||||
leecher=$(printf '%s' "$4" | sed -n "${num}p")
|
||||
size=$(printf '%s' "$5" | sed -n "${num}p")
|
||||
printf '%s\n' "$num - $line | $category | $seeder | $leecher | $size"
|
||||
num=$(($num + 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?"
|
||||
|
||||
token=$(curl -sLH "User-agent: 'your bot 0.1'" "${base_url}get_token=get_token&app_id=pirokit" | jq -r '.token')
|
||||
|
||||
default_args="&token=${token}&limit=100&app_id=pirokit&format=json_extended"
|
||||
|
||||
|
||||
if [ "$query" = "" ]; then
|
||||
url="${base_url}mode=list${default_args}"
|
||||
else
|
||||
url="${base_url}mode=search&search_string=${query}$&sort=seeders${default_args}"
|
||||
fi
|
||||
|
||||
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}");;
|
||||
Movies) response=$(curl -sLH "User-agent: 'your bot 0.1'" "${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");;
|
||||
Games) response=$(curl -sLH "User-agent: 'your bot 0.1'" "${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");;
|
||||
esac
|
||||
|
||||
[ "$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
|
||||
|
||||
# echo "$response" | jq '.'
|
||||
# exit 1
|
||||
|
||||
titles=$(printf '%s\n' "$response" | jq -r '.[] | .[].title')
|
||||
|
||||
seeders=$(printf '%s\n' "$response" | jq -r '.[] | .[].seeders')
|
||||
|
||||
leechers=$(printf '%s\n' "$response" | jq -r '.[] | .[].leechers')
|
||||
|
||||
sizes=$(convert_sizes "$(printf '%s\n' "$response" | jq -r '.[] | .[].size')")
|
||||
|
||||
magnets=$(printf '%s\n' "$response" | jq -r '.[] | .[].download')
|
||||
|
||||
categorys=$(printf '%s\n' "$response" | jq -r '.[] | .[].category')
|
||||
|
||||
number=$(list "$titles" "$categorys" "$seeders" "$leechers" "$sizes")
|
||||
[ "$number" = "" ] && exit
|
||||
|
||||
link=$(printf '%s\n' "$magnets" | sed -n "${number}p")
|
||||
|
||||
transmission-remote -a "$link" && notify-send "RARBG" "Downloading selected torrent."
|
@ -14,7 +14,7 @@ move () {
|
||||
"$HOME/games/torrents"
|
||||
)
|
||||
|
||||
current=$(transmission-remote -t 1 -i | grep -i location | awk '{print $2}')
|
||||
current=$(transmission-remote -t $1 -i | grep -i location | awk '{print $2}')
|
||||
|
||||
choice=$(printf '%s\n' "${paths[@]}" | $DMENU -p "Current: $current")
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user