This commit is contained in:
CoolnsX
2022-01-31 22:44:55 +05:30
parent 850394eed4
commit 12b79c4682
6 changed files with 34 additions and 22 deletions

22
ani-cli
View File

@@ -145,15 +145,6 @@ anime_selection () {
## Ep selection ## ## Ep selection ##
################## ##################
episode_selection () {
[ $is_download -eq 1 ] &&
printf "Range of episodes can be specified: start_number end_number\n"
printf "${c_blue}Choose episode $c_cyan[1-%d]$c_reset:$c_green " $last_ep_number
read ep_choice_start ep_choice_end
printf "$c_reset"
}
open_episode () { open_episode () {
anime_id=$1 anime_id=$1
episode=$2 episode=$2
@@ -174,7 +165,8 @@ open_episode () {
if [ $is_download -eq 0 ]; then if [ $is_download -eq 0 ]; then
if [ $is_cast -eq 0 ]; then if [ $is_cast -eq 0 ]; then
setsid -f $player_fn --http-header-fields="Referer: $embedded_url" "$video_url" >/dev/null 2>&1 ([ -z $ep_choice_end ] &&
setsid -f $player_fn --referrer="$embedded_url" "$video_url" >/dev/null 2>&1 || $player_fn --referrer="$embedded_url" "$video_url" >/dev/null 2>&1)
else else
catt cast "$video_url" catt cast "$video_url"
fi fi
@@ -183,8 +175,7 @@ open_episode () {
# add 0 padding to the episode name # add 0 padding to the episode name
episode=$(printf "%03d" $episode) episode=$(printf "%03d" $episode)
{ {
# aria2c -x 16 -s 16 --referer "$embedded_url" "$video_url" --dir=MOVIES -o "${anime_id}-${episode}.mp4" && aria2c -x 16 -s 16 --referer "$embedded_url" "$video_url" --dir=MOVIES -o "${anime_id}-${episode}.mp4" &&
aria2c --referer "$embedded_url" "$video_url" --dir=MOVIES -o "${anime_id}-${episode}.mp4" &&
printf "${c_green}Downloaded episode: %s${c_reset}\n" "$episode" || printf "${c_green}Downloaded episode: %s${c_reset}\n" "$episode" ||
printf "${c_red}Download failed episode: %s${c_reset}\n" "$episode" printf "${c_red}Download failed episode: %s${c_reset}\n" "$episode"
} }
@@ -225,7 +216,10 @@ get_search_query "$*"
search_results=$(search_anime "$query") search_results=$(search_anime "$query")
[ -z "$search_results" ] && die "No search results found" [ -z "$search_results" ] && die "No search results found"
anime_selection "$search_results" anime_selection "$search_results"
episode_selection [ $is_download -eq 1 ] && printf "Range of episodes can be specified: start_number end_number\n"
printf "${c_blue}Choose episode $c_cyan[1-%d]$c_reset:$c_green " $last_ep_number
read ep_choice_start ep_choice_end
printf "$c_reset"
{ # checking input { # checking input
[ "$ep_choice_start" -eq "$ep_choice_start" ] 2>/dev/null || die "Invalid number entered" [ "$ep_choice_start" -eq "$ep_choice_start" ] 2>/dev/null || die "Invalid number entered"
@@ -280,7 +274,7 @@ while :; do
break;; break;;
*) *)
die "invalid choice" err "invalid choice"
;; ;;
esac esac

View File

@@ -5,7 +5,7 @@
* *
* font: see http://freedesktop.org/software/fontconfig/fontconfig-user.html * font: see http://freedesktop.org/software/fontconfig/fontconfig-user.html
*/ */
static char *font = "JetBrains Mono:style=Bold:pixelsize=18:antialias=true:autohint=true"; static char *font = "JetBrains Mono NL:style=Regular:pixelsize=18:antialias=true:autohint=true";
static int borderpx = 0; static int borderpx = 0;

Binary file not shown.

Binary file not shown.

View File

@@ -59,7 +59,7 @@ fullURL="${baseurl}${url}/"
curl -s $fullURL -o $cachedir/tmp.html curl -s $fullURL -o $cachedir/tmp.html
magnet=$(grep -Po "magnet.*\" " $cachedir/tmp.html | tr -d \") magnet=$(grep -Po "magnet.*\" " $cachedir/tmp.html | tr -d \")
echo $magnet > .cache/maglink echo $magnet > $HOME/.cache/maglink
st -e $HOME/repos_scripts/torrent "$magnet" & st -e $HOME/repos_scripts/torrent "$magnet" &

30
torrent
View File

@@ -1,34 +1,52 @@
#!/bin/sh #!/bin/sh
c_red="\033[1;31m"
c_green="\033[1;32m"
c_yellow="\033[1;33m"
c_blue="\033[1;34m"
c_magenta="\033[1;35m"
c_cyan="\033[1;36m"
c_reset="\033[0m"
full_tor(){ full_tor(){
tput reset
notify-send "Torrent:Rukk ja cheecha Download ho rha hai" notify-send "Torrent:Rukk ja cheecha Download ho rha hai"
aria2c -d $2 --seed-time=0 "$1" && notify-send "Torrent:cheecha download hogyi" || notify-send -u critical "Torrent:cheecha error!!" aria2c -d $2 --seed-time=0 "$1" && notify-send "Torrent:cheecha download hogyi" && rm -f $file || notify-send -u critical "Torrent:cheecha error!!"
} }
part_tor(){ part_tor(){
aria2c --dir=$HOME/.cache --bt-metadata-only=true --bt-save-metadata=true "$1" aria2c --dir=$HOME/.cache --bt-metadata-only=true --bt-save-metadata=true "$1"
tput reset
aria2c --show-files=true $HOME/.cache/*.torrent aria2c --show-files=true $HOME/.cache/*.torrent
printf "Enter index of the file to download:" printf "Enter file idx(default=all):"
read -r ind read -r ind
tput reset
notify-send "Torrent:Rukk ja cheecha Download ho rha hai" notify-send "Torrent:Rukk ja cheecha Download ho rha hai"
aria2c --select-file=$ind -d $2 --seed-time=0 $HOME/.cache/*.torrent && notify-send "Torrent:cheecha download hogyi" || notify-send -u critical "Torrent:cheecha error!!" aria2c --select-file=$ind -d $2 --seed-time=0 $HOME/.cache/*.torrent && notify-send "Torrent:cheecha download hogyi" && rm -f $file || notify-send -u critical "Torrent:cheecha error!!"
rm -f $HOME/.cache/*.torrent rm -f $HOME/.cache/*.torrent
} }
if [ -z "$*" ]; then trap "rm -f $HOME/.cache/*.torrent;exit 0" INT HUP
magnet="$(xclip -out clipboard)" file=$HOME/.cache/maglink
xclip -out clipboard > $file
if [ -f "$file" ]; then
magnet=$(cat $file)
else else
magnet=$* magnet=$*
fi fi
echo "$magnet" echo "$magnet"
x=$(printf "MOVIES\\nSoftwares" | dmenu -p "Select Directory :" | tr -d '\n') x=$(printf "MOVIES\\nSoftwares" | dmenu -p "Select Directory :" | tr -d '\n')
printf "Download>>>\n[f]ull torrent\n[p]artial torrent\n\tenter choice:" 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:"
read -r ch read -r ch
case $ch in case $ch in
f) f)
full_tor "$magnet" "$x";; full_tor "$magnet" "$x";;
p) p)
part_tor "$magnet" "$x";; part_tor "$magnet" "$x";;
q)
break;;
esac esac