Skip to content

Commit

Permalink
fix: (#542) and (#515)
Browse files Browse the repository at this point in the history
* refactor: slightly fasten up script for majority of animes

* chore: version bump 1.8.0 -> 1.8.1

* style: spaces -> tabs

* refactor: change single condition if-else statement to one-liner

* refactor: optimize aria2c

* refactor: remove unused case arm

* refactor: move do statement to for loop row

* docs: remove make as dependency for termux
  • Loading branch information
RaynardGerraldo authored and 71zenith committed Feb 20, 2022
1 parent a16d24d commit 54169b8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ scoop install ani-cli -g
Install termux [(Guide)](https://termux.com/)

```sh
pkg install git make termux-tools ncurses-utils openssl-tool -y
pkg install git termux-tools ncurses-utils openssl-tool -y
git clone https://github.com/pystardust/ani-cli && cd ani-cli
cp ani-cli $PREFIX/bin/ani-cli
echo 'am start --user 0 -a android.intent.action.VIEW -d "$2" -n is.xyz.mpv/.MPVActivity' > $PREFIX/bin/mpv
Expand Down
20 changes: 9 additions & 11 deletions ani-cli
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# Project repository: https://github.com/pystardust/ani-cli

# Version number
VERSION="1.8.0"
VERSION="1.8.1"

#######################
# AUXILIARY FUNCTIONS #
Expand Down Expand Up @@ -154,9 +154,11 @@ get_dpage_link() {
# get the download page url
anime_id="$1"
ep_no="$2"
# credits to fork: https://github.com/Dink4n/ani-cli for the fix
anime_page=$(curl -s "$base_url/$anime_id-$ep_no")
printf '%s' "$anime_page" | grep -q '404' && anime_page=$(curl -s "$base_url/$anime_id-episode-$ep_no")
# credits to fork: https://github.com/Dink4n/ani-cli for the fix
for params in "-episode-$ep_no" "-$ep_no" "-episode-$ep_no-1" "-camrip-episode-$ep_no"; do
anime_page=$(curl -s "$base_url/$anime_id$params")
printf '%s' "$anime_page" | grep -q '404' || break
done
printf '%s' "$anime_page" |
sed -n -E 's/^[[:space:]]*<a href="#" rel="100" data-video="([^"]*)".*/\1/p' |
sed 's/^/https:/g'
Expand Down Expand Up @@ -441,9 +443,7 @@ open_episode () {
# add 0 padding to the episode name
episode=$(printf "%03d" "$episode")
{
#uncomment this below line if you are getting low download speeds, and comment next one after below line
#aria2c -x 16 -s 16 --referer="$dpage_link" "$video_url" --dir="$download_dir" -o "${anime_id}-${episode}.mp4" --download-result=hide &&
if aria2c --referer="$dpage_link" "$video_url" --dir="$download_dir" -o "${anime_id}-${episode}.mp4" --download-result=hide ; then
if aria2c -x 16 -s 16 --referer="$dpage_link" "$video_url" --dir="$download_dir" -o "${anime_id}-${episode}.mp4" --download-result=hide ; then
inf "Downloaded episode: $episode"
else
err "Download failed episode: $episode , please retry or check your internet connection"
Expand Down Expand Up @@ -611,11 +611,9 @@ if [ -z "$select_first" ]; then
h)
search_history
;;
N)
ep_choice_start=$((episode + 1))
;;
q)
break;;
break
;;
*)
tput clear
err "Invalid choice"
Expand Down

0 comments on commit 54169b8

Please sign in to comment.