diff options
| author | Raymaekers Luca <raymaekers.luca@gmail.com> | 2024-07-11 21:04:36 +0200 | 
|---|---|---|
| committer | Raymaekers Luca <raymaekers.luca@gmail.com> | 2024-07-11 21:04:36 +0200 | 
| commit | 74deca210112c697225d4868fec1edf837c5a457 (patch) | |
| tree | 1284a5062650d9b1d3c107a60b0a7e114cfc8280 /bin/menuscripts/tsh | |
| parent | 24f0ae1ca95a64ae065b2c7fcc129709b3b61091 (diff) | |
checkpoint
Diffstat (limited to 'bin/menuscripts/tsh')
| -rwxr-xr-x | bin/menuscripts/tsh | 13 | 
1 files changed, 7 insertions, 6 deletions
diff --git a/bin/menuscripts/tsh b/bin/menuscripts/tsh index d07d0d5..ea582d8 100755 --- a/bin/menuscripts/tsh +++ b/bin/menuscripts/tsh @@ -42,7 +42,7 @@ cleanup() {  list_modules() { find -L "$MODULES_PATH" -type f -printf "%f\n"; } -trap "exit 1" INT +trap "exit 2" INT  trap "cleanup" EXIT  ## OPTIONS @@ -103,7 +103,7 @@ for p in $deps; do  		error=1  	fi  done -[ "${error:-0}" -eq 1 ] && exit 1 +[ "${error:-0}" -eq 1 ] && exit 3  # Get the torrents with module  if [ "${skip:-0}" -eq 1 ]; then @@ -119,7 +119,7 @@ else  			head -n 1  		fi | tr ' ' '+'  	)" -	[ "$query" ] || exit 1 +	[ "$query" ] || exit 4  	# shellcheck source=/usr/local/lib/$PROG/nyaa.sh disable=SC1091  	. "$MODULES_PATH/$module" @@ -132,6 +132,7 @@ else  	printf "%s\n" "$module" >>"$links"  fi +# Default sorting if unset  command -v sort_results >/dev/null || sort_results() { sort -k3 -n -r; }  # select result from "$results" @@ -147,7 +148,7 @@ for choice in $(  	printf 'choice: %s\n' "$(sed -n "${choice}p" "$results" | cut -f 3-)"  	magnet="$(get_magnet "$choice")" -	[ "$magnet" ] || exit 1 +	[ "$magnet" ] || exit 5  	if [ -z "$noaskfiles" ] && confirm 'files?'; then  		hash="${1##*btih:}" @@ -159,9 +160,9 @@ for choice in $(  		rm -f "$tmp"/.torrent  	fi -	if [ "$noaskdownload" ] || confirm 'download?'; then +	if [ -z "$noaskdownload" ] && confirm 'download?'; then  		[ "$category" ] || category="$(printf '%s' "$categories" | tr ' ' '\n' | fzf)" -		[ "$category" ] || exit 2 +		[ "$category" ] || exit 6  		transmission-remote debuc.com -a "$magnet" -w "/downloads/$category"  	elif confirm "copy?"; then  		echo "$magnet" | clipp  | 
