diff options
author | Raymaekers Luca <raymaekers.luca@gmail.com> | 2024-06-22 02:05:44 +0200 |
---|---|---|
committer | Raymaekers Luca <raymaekers.luca@gmail.com> | 2024-06-22 02:05:44 +0200 |
commit | 36d2972c60ec86b873fa496d1f5ea95cf748cf49 (patch) | |
tree | a6d6750fa17c2964cd241afa8e963cac6106b390 /bin/menuscripts/tsh | |
parent | 4914b43f642e2772a140a8f9b1f26b4e555ed88b (diff) | |
parent | 32256e087aaf7744348a5ba33e802d5c8d9d97dd (diff) |
Merge branch 'main' of db:dotfiles
Diffstat (limited to 'bin/menuscripts/tsh')
-rwxr-xr-x | bin/menuscripts/tsh | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/bin/menuscripts/tsh b/bin/menuscripts/tsh index aac27ee..0c57ee0 100755 --- a/bin/menuscripts/tsh +++ b/bin/menuscripts/tsh @@ -5,8 +5,8 @@ PROG="$(basename "$0")" # copy command and deps variable deps="pup curl $MENUCMD" -LIBPFX=/home/aluc/.local/share/tsh -module='1337x.sh' # default module +MODULES_PATH=$HOME/.local/share/tsh +module='nyaa.sh' # default module # Files export tmp="/tmp/$PROG" @@ -83,7 +83,7 @@ cleanup () done } -list_modules () { find -L "$LIBPFX" -type f -printf "%f\n"; } +list_modules () { find -L "$MODULES_PATH" -type f -printf "%f\n"; } # get a query from user based on MENUCMD get_query () @@ -121,14 +121,6 @@ show_files() rm -f "$tmp"/.torrent } -# Select a type after having displayed them with 'show_types' -select_type() -{ - for type in $categories - do printf "%s\n" "$type" - done | fzf -} - trap "exit 1" INT trap "cleanup" EXIT @@ -179,7 +171,7 @@ then # Get results rm -f "$results" "$links" # shellcheck source=/usr/local/lib/$PROG/nyaa.sh disable=SC1091 - . "$LIBPFX/$module" + . "$MODULES_PATH/$module" [ -f "$results" ] || die "No results." # Save which module was used @@ -190,7 +182,7 @@ fi # acquire get_magnet function # shellcheck source=/usr/local/lib/$PROG/nyaa.sh disable=SC1091 -getfunctions=1 . "$LIBPFX/$module" +getfunctions=1 . "$MODULES_PATH/$module" # select result from "$results" for choice in $(select_result | xargs) @@ -205,7 +197,8 @@ do if [ "$noaskdownload" ] || confirm 'download?' then - [ "${category:-$(select_type)}" ] || exit 1 + [ "$category" ] || category="$(printf '%s' "$categories" | tr ' ' '\n' | fzf)" + [ "$category" ] || exit 2 transmission-remote debuc.com -a "$magnet" -w "/downloads/$category" elif confirm "copy?" then |