From ed4a0cf6c9c59f842b92cf83caff9f066884383f Mon Sep 17 00:00:00 2001 From: CoolnsX Date: Wed, 2 Mar 2022 22:20:36 +0530 Subject: [PATCH] code cleanup --- ani-new | 1 + rss | 4 ++-- torrent | 7 ++++--- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/ani-new b/ani-new index 7202c75..c0a28f2 100755 --- a/ani-new +++ b/ani-new @@ -10,6 +10,7 @@ decrypt_link() { curl -s -H "X-Requested-With:XMLHttpRequest" -H "User-Agent:$agent" -H "Referer:https:$1" "$ajax_url" -d "id=$ajax" -d "time=69420691337800813569" | jq -r '.source[].file' | head -4 | tail -1 } +notify-send -t 1000 "parsing gogoanime.... please wait!!" url=$(curl -s -A "$agent" "https://gogoanime.film" | sed -nE 's/.*"name".*href="\/([^"]*)".*/\1/p' | dmenu -p "Select anime:") [ -z "$url" ] && notify-send -u critical "Err.. no anime selected" && exit 0 refr=$(curl -s -A "$agent" "https://gogoanime.film/$url" | sed -n -E 's/^[[:space:]]* $HOME/.cache/rss #extracting names and providing the menu for selecting particular title @@ -16,4 +16,4 @@ id=$(printf "$name" | sed -n -e 's/.*\[\(.*\)\].*/\1/p') magnet=$(sed -n -e "s/link>\(.*$id.*\).*/\1/p" .cache/rss | sed 's/amp;//g') #custom script for downloading torrent using aria2c.. you can use your own bittorrent client here -setsid -f st -e $HOME/repo_scripts/torrent "$magnet" +st -e $HOME/repos_scripts/torrent "$magnet" & diff --git a/torrent b/torrent index 4841aee..9f19c35 100755 --- a/torrent +++ b/torrent @@ -9,10 +9,11 @@ c_reset="\033[0m" down(){ tput reset notify-send "Torrent: Downloading" - aria2c -d movies --select-file=$2 --seed-time=0 $1 && notify-send "Torrent: Download complete" && rm -f $file || notify-send -u critical "Torrent: Error!!" } + aria2c -d movies --select-file=$2 --seed-time=0 $1 && notify-send "Torrent: Download complete" && rm -f $file || notify-send -u critical "Torrent: Error!!" +} trap "rm -f $HOME/.cache/*.torrent;exit 0" INT HUP -[ -z "$*" ] && magnet=$(xclip -out clipboard) || magnet=$* +[ -z "$*" ] && magnet="$(xclip -out clipboard)" || magnet="$*" echo "$magnet" printf "${c_yellow}Download>>\n${c_green}[f]ull torrent\n${c_cyan}[p]artial torrent \n${c_red}[q]uit" printf "${c_reset}\n\tenter choice:" @@ -29,5 +30,5 @@ case $ch in down "$HOME/.cache/*.torrent" "$ind" rm -f $HOME/.cache/*.torrent;; q) - break;; + exit 0;; esac