From a415ed0a2b21c8e5facd4adff29490b80862270a Mon Sep 17 00:00:00 2001 From: Cat Date: Thu, 12 Sep 2024 09:00:03 +0000 Subject: [PATCH 01/19] docs: FAQ (#1413) --- README.md | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 300065a86..3e1313b63 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,7 @@ A cli to browse and watch anime (alone AND with friends). This tool scrapes the - [Uninstall](#uninstall) - [Dependencies](#dependencies-1) - [Ani-Skip](#ani-skip) +- [FAQ](#faq) - [Homies](#homies) - [Contribution Guidelines](./CONTRIBUTING.md) - [Disclaimer](./disclaimer.md) @@ -255,7 +256,7 @@ Make sure apk is updated using ```apk update; apk upgrade``` then run this: ```sh -apk add grep sed curl fzf git aria2 ncurses +apk add grep sed curl fzf git aria2 ncurses patch apk add ffmpeg git clone --depth 1 https://github.com/pystardust/ani-cli ~/.ani-cli cp ~/.ani-cli/ani-cli /usr/local/bin/ani-cli @@ -521,6 +522,22 @@ Ani-skip uses the external lua script function of mpv and as such – for now **Note:** It may be, that ani-skip won't know the anime you're trying to watch. Try using the `--skip-title ` command line argument. (It uses the [aniskip API](https://github.com/lexesjan/typescript-aniskip-extension/tree/main/src/api/aniskip-http-client) and you can contribute missing anime or ask for including it in the database on their [discord server](https://discord.com/invite/UqT55CbrbE)). +## FAQ +<details> + +* Can I change subtitle language or turn them off? - No, the subtitles are baked into the video. +* Can I watch dub? - Yes, use `--dub`. +* Can I change dub language? - No. +* Can I change media source? - No (unless you can scrape that source yourself). +* Can I use vlc? - Yes, use `--vlc` or `export ANI_CLI_PLAYER=vlc`. +* Can I adjust resolution? - `Yes, use -q resolution`, for example `ani-cli -q 1080`. +* How can I download? - Use `-d`, it will download into your working directory. +* How can I bulk download? - `Use -d -e firstepisode-lastepisode`, for example `ani-cli onepiece -d -e 1-1000`. + +**Note:** All features are documented in `ani-cli --help`. + +</details> + ## Homies * [animdl](https://github.com/justfoolingaround/animdl): Ridiculously efficient, fast and light-weight (supports most sources: allanime, zoro ... (Python) From b9c6eb9e90a2e881208363b49c93271eeb2df8c7 Mon Sep 17 00:00:00 2001 From: luca <130000481+lucathehun@users.noreply.github.com> Date: Sat, 14 Sep 2024 06:50:42 +0200 Subject: [PATCH 02/19] feat: tab-completion for zsh and bash (#1419) --- README.md | 21 +++++++++++++++++++++ _ani-cli-bash | 45 +++++++++++++++++++++++++++++++++++++++++++++ _ani-cli-zsh | 30 ++++++++++++++++++++++++++++++ 3 files changed, 96 insertions(+) create mode 100644 _ani-cli-bash create mode 100644 _ani-cli-zsh diff --git a/README.md b/README.md index 3e1313b63..c1a2a0852 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,9 @@ A cli to browse and watch anime (alone AND with friends). This tool scrapes the - [Tier 2: Windows, WSL, iOS, Steam Deck, FreeBSD](#tier-2-support-windows-wsl-ios-steam-deck-FreeBSD) - [From Source](#installing-from-source) - [Uninstall](#uninstall) +- [Completion](#completion) + - [bash](#bash) + - [zsh](#zsh) - [Dependencies](#dependencies-1) - [Ani-Skip](#ani-skip) - [FAQ](#faq) @@ -496,6 +499,24 @@ apk del grep sed curl fzf git aria2 ffmpeg ncurses </details> +## Completion + +### bash + +To add tab completions using bash run the following command inside the ani-cli directory +``` +cp _ani-cli-bash /path/to/your/completions +echo "source /path/to/your/completions/_ani-cli-bash" >> ~/.bashrc +``` + +### zsh + +To add tab completions using zsh run the following command inside the ani-cli directory +``` +cp _ani-cli-zsh /path/to/your/completions +echo "source /path/to/your/completions/_ani-cli-zsh" >> ~/.zshrc +``` + ## Dependencies - grep diff --git a/_ani-cli-bash b/_ani-cli-bash new file mode 100644 index 000000000..7b1827e4b --- /dev/null +++ b/_ani-cli-bash @@ -0,0 +1,45 @@ +#!/bin/bash + +_ani_cli_autocomplete() { + local cur prev opts + + # Get the current and previous words in the command line + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + + # Define the main options + opts=" + -c --continue + -d --download + -D --delete + -s --syncplay + -S --select-nth + -q --quality + -v --vlc + -V --version + -h --help + -e --episode + --dub + --rofi + --skip + --no-detach + -N --nextep-countdown + -U --update + " + + # Check for conditional options + if [[ "${COMP_WORDS[@]}" =~ "--no-detach" ]]; then + opts+=" --exit-after-play" + fi + + if [[ "${COMP_WORDS[@]}" =~ "-e" || "${COMP_WORDS[@]}" =~ "--episode" ]]; then + opts+=" -r --range" + fi + + # Use `compgen` to generate the options based on the current word + COMPREPLY=($(compgen -W "${opts}" -- "$cur")) +} + +# Register the completion function for `ani-cli` +complete -F _ani_cli_autocomplete ani-cli diff --git a/_ani-cli-zsh b/_ani-cli-zsh new file mode 100644 index 000000000..1ce3736f7 --- /dev/null +++ b/_ani-cli-zsh @@ -0,0 +1,30 @@ +#!/bin/zsh + +# Enable autocompletion for zsh +autoload -U compinit && compinit + +_ani-cli() { + _arguments \ + '(-c --continue)'{-c,--continue}'[Continue watching from history]' \ + '(-d --download)'{-d,--download}'[Download the video instead of playing it]' \ + '(-D --delete)'{-D,--delete}'[Delete the downloaded video]' \ + '(-s --syncplay)'{-s,--syncplay}'[Use Syncplay to watch with friends]' \ + '(-S --select-nth)'{-S,--select-nth}'[Select nth entry]' \ + '(-q --quality)'{-q,--quality}'[Specify the video quality]' \ + '(-v --vlc)'{-v,--vlc}'[Use VLC to play the video]' \ + '(-V --version)'{-V,--version}'[Show the version of the script]' \ + '(-h --help)'{-h,--help}'[Show help this help message]' \ + '(-e --episode)'{-e,--episode}'[Specify the episode to watch]' \ + '(-e --episode)'{-r,--range}'[Specify the range of episodes to watch]' \ + '--dub[Dub the video]' \ + '--rofi[Use rofi instead of fzf]' \ + '--skip[Use ani-skip to skip the intro of the episode (mpv only)]' \ + "--no-detach[ Don't detach the player (useful for in-terminal playback, mpv only)]" \ + '(--no-detach)--exit-after-play[Exit after the video is played]' \ + '--skip-title[Use given title as ani-skip query]' \ + '(-N --nextep-countdown)'{-N,--nextep-countdown}'[Countdown to next episode]' \ + '(-U --update)'{-U,--update}'[Update the script]' +} + +# Register the completion function for `ani-cli` +compdef _ani-cli ani-cli From 8c11be8caba2031f3e6dbb93f708f86185a114bb Mon Sep 17 00:00:00 2001 From: port19 <port19@port19.xyz> Date: Mon, 16 Sep 2024 15:03:01 +0200 Subject: [PATCH 03/19] chore: fix ani-cli ci oopsie caused by completion (#1420) --- .github/workflows/ani-cli.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ani-cli.yml b/.github/workflows/ani-cli.yml index 884fc4376..0f31093dd 100644 --- a/.github/workflows/ani-cli.yml +++ b/.github/workflows/ani-cli.yml @@ -4,8 +4,11 @@ on: branches: - master pull_request: - paths: + paths: - "**ani-cli" + paths-ignore: + - "_ani-cli-bash" + - "_ani-cli-zsh" jobs: sh-checker: From 765136d93cdc1f1aa0f21152088d7b4d824d55e0 Mon Sep 17 00:00:00 2001 From: 9e4ed328ce2e8702c291c14f2471861a-255418 <professormagicae@tutamail.com> Date: Mon, 16 Sep 2024 18:11:13 +0200 Subject: [PATCH 04/19] docs: explain how to change download folder in the FAQ (#1421) --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index c1a2a0852..24fabf5a2 100644 --- a/README.md +++ b/README.md @@ -553,6 +553,7 @@ Ani-skip uses the external lua script function of mpv and as such – for now * Can I use vlc? - Yes, use `--vlc` or `export ANI_CLI_PLAYER=vlc`. * Can I adjust resolution? - `Yes, use -q resolution`, for example `ani-cli -q 1080`. * How can I download? - Use `-d`, it will download into your working directory. +* Can i change download folder? - Yes, set the `ANI_CLI_DOWNLOAD_DIR` to your desired location. * How can I bulk download? - `Use -d -e firstepisode-lastepisode`, for example `ani-cli onepiece -d -e 1-1000`. **Note:** All features are documented in `ani-cli --help`. From 62e872eb73d63d2c853a45a578d090365c965141 Mon Sep 17 00:00:00 2001 From: Derisis13 <66648475+Derisis13@users.noreply.github.com> Date: Wed, 18 Sep 2024 16:20:00 +0200 Subject: [PATCH 05/19] feat: added flag for mpv as flatpak (#1411) Co-authored-by: port19 <port19@port19.xyz> --- .github/workflows/ani-cli.yml | 6 +++--- .github/workflows/markdown.yml | 2 +- .github/workflows/version.yml | 2 +- ani-cli | 24 ++++++++++++++++-------- 4 files changed, 21 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ani-cli.yml b/.github/workflows/ani-cli.yml index 0f31093dd..387313e4f 100644 --- a/.github/workflows/ani-cli.yml +++ b/.github/workflows/ani-cli.yml @@ -15,7 +15,7 @@ jobs: name: Shellcheck + Shfmt runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Run the sh-checker uses: luizm/action-sh-checker@master env: @@ -26,7 +26,7 @@ jobs: name: Executable Bit runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: test exec bit run: test -x "./ani-cli" @@ -34,6 +34,6 @@ jobs: name: No Awk Allowed runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: verify that noone added awk run: '! grep awk "./ani-cli"' diff --git a/.github/workflows/markdown.yml b/.github/workflows/markdown.yml index 0dacb020b..6bc210753 100644 --- a/.github/workflows/markdown.yml +++ b/.github/workflows/markdown.yml @@ -22,5 +22,5 @@ jobs: name: Find Trailing Whitespace runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: ocular-d/trailing-spaces@0.0.2 diff --git a/.github/workflows/version.yml b/.github/workflows/version.yml index d8ce20d21..0dce9c044 100644 --- a/.github/workflows/version.yml +++ b/.github/workflows/version.yml @@ -9,7 +9,7 @@ jobs: name: Version Bump runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - name: check version bump diff --git a/ani-cli b/ani-cli index d00427b08..18da3f674 100755 --- a/ani-cli +++ b/ani-cli @@ -1,6 +1,6 @@ #!/bin/sh -version_number="4.9.0" +version_number="4.9.1" # UI @@ -122,6 +122,12 @@ where_iina() { dep_ch iina # exit with formating } +where_mpv() { + command -v "$ANI_CLI_PLAYER" >/dev/null && printf "%s" "$ANI_CLI_PLAYER" && return 0 + command -v "flatpak" >/dev/null && flatpak info io.mpv.Mpv >/dev/null 2>&1 && printf "%s" "flatpak_mpv" && return 0 + dep_ch mpv # exit with formating +} + # SCRAPING # extract the video links from response of embed urls, extract mp4 links form m3u8 lists @@ -333,12 +339,17 @@ download_dir="${ANI_CLI_DOWNLOAD_DIR:-.}" log_episode="${ANI_CLI_LOG:-1}" quality="${ANI_CLI_QUALITY:-best}" case "$(uname -a)" in - *Darwin*) player_function="$(where_iina)" ;; # mac OS + *Darwin*) # mac OS + player_function="$(where_iina)" + [ $? -eq 0 ] || exit $? + ;; *ndroid*) player_function="${ANI_CLI_PLAYER:-android_mpv}" ;; # Android OS (termux) - *neptune*) player_function="${ANI_CLI_PLAYER:-flatpak_mpv}" ;; # steamdeck OS *MINGW* | *WSL2*) player_function="${ANI_CLI_PLAYER:-mpv.exe}" ;; # Windows OS *ish*) player_function="${ANI_CLI_PLAYER:-iSH}" ;; # iOS (iSH) - *) player_function="${ANI_CLI_PLAYER:-mpv}" ;; # Linux OS + *) # Linux OS + player_function="${ANI_CLI_PLAYER:-$(where_mpv)}" + [ $? -eq 0 ] || exit $? + ;; esac no_detach="${ANI_CLI_NO_DETACH:-0}" @@ -431,13 +442,10 @@ if [ -z "$ANI_CLI_NON_INTERACTIVE" ]; then dep_ch fzf || true; fi case "$player_function" in debug) ;; download) dep_ch "ffmpeg" "aria2c" ;; - flatpak*) - dep_ch "flatpak" - flatpak info io.mpv.Mpv >/dev/null 2>&1 || die "Program \"mpv (flatpak)\" not found. Please install it." - ;; android*) printf "\33[2K\rChecking of players on Android is disabled\n" ;; *iSH*) printf "\33[2K\rChecking of players on iOS is disabled\n" ;; *iina*) true ;; # handled out of band in where_iina + *mpv*) true ;; # handled out of band in where_mpv *) dep_ch "$player_function" ;; esac From 353a201c73ebe3d762272b49e36f4d2d0ac75b7b Mon Sep 17 00:00:00 2001 From: port19 <port19@port19.xyz> Date: Wed, 18 Sep 2024 17:56:58 +0200 Subject: [PATCH 06/19] ci: fix conflicting path and path ignore (#1425) --- .github/workflows/ani-cli.yml | 5 +---- .github/workflows/inverse-ani.yml | 2 +- .github/workflows/version.yml | 2 +- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ani-cli.yml b/.github/workflows/ani-cli.yml index 387313e4f..da6ef9ab9 100644 --- a/.github/workflows/ani-cli.yml +++ b/.github/workflows/ani-cli.yml @@ -5,10 +5,7 @@ on: - master pull_request: paths: - - "**ani-cli" - paths-ignore: - - "_ani-cli-bash" - - "_ani-cli-zsh" + - "/ani-cli" jobs: sh-checker: diff --git a/.github/workflows/inverse-ani.yml b/.github/workflows/inverse-ani.yml index c19f9cd2a..75bb5076a 100644 --- a/.github/workflows/inverse-ani.yml +++ b/.github/workflows/inverse-ani.yml @@ -5,7 +5,7 @@ name: 'ani-cli checks' on: pull_request: paths-ignore: - - "**ani-cli" + - "/ani-cli" jobs: sh-checker: name: Shellcheck + Shfmt diff --git a/.github/workflows/version.yml b/.github/workflows/version.yml index 0dce9c044..5bdb93046 100644 --- a/.github/workflows/version.yml +++ b/.github/workflows/version.yml @@ -2,7 +2,7 @@ name: 'ani-cli checks' on: pull_request: paths: - - "**ani-cli" + - "/ani-cli" jobs: version-bump: From 7fb117b0bc922279ad18e741f83553a4b059e524 Mon Sep 17 00:00:00 2001 From: port19 <port19@port19.xyz> Date: Wed, 18 Sep 2024 18:19:04 +0200 Subject: [PATCH 07/19] ci: shellcheck completion file annoyance (#1426) --- .github/workflows/ani-cli.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ani-cli.yml b/.github/workflows/ani-cli.yml index da6ef9ab9..fb9694b6b 100644 --- a/.github/workflows/ani-cli.yml +++ b/.github/workflows/ani-cli.yml @@ -18,6 +18,8 @@ jobs: env: SHELLCHECK_OPTS: -s sh -o all -e 2250 SHFMT_OPTS: -i 4 -ci -d + with: + sh_checker_exclude: "_ani-cli-bash _ani-cli-zsh" check-exec: name: Executable Bit From 81e6ecd8299b3014818a6eebec152cbf0ff247a2 Mon Sep 17 00:00:00 2001 From: Mori Zen <71zenith@proton.me> Date: Wed, 18 Sep 2024 23:04:43 +0530 Subject: [PATCH 08/19] fix: where_mpv checks for mpv than ANI_CLI_PLAYER (#1424) Co-authored-by: port19 <port19@port19.xyz> --- .github/workflows/ani-cli.yml | 2 +- ani-cli | 23 +++++++---------------- 2 files changed, 8 insertions(+), 17 deletions(-) diff --git a/.github/workflows/ani-cli.yml b/.github/workflows/ani-cli.yml index fb9694b6b..69292b5a4 100644 --- a/.github/workflows/ani-cli.yml +++ b/.github/workflows/ani-cli.yml @@ -5,7 +5,7 @@ on: - master pull_request: paths: - - "/ani-cli" + - "**ani-cli" jobs: sh-checker: diff --git a/ani-cli b/ani-cli index 18da3f674..f56ff7041 100755 --- a/ani-cli +++ b/ani-cli @@ -1,6 +1,6 @@ #!/bin/sh -version_number="4.9.1" +version_number="4.9.2" # UI @@ -116,16 +116,13 @@ dep_ch() { } where_iina() { - [ -n "$ANI_CLI_PLAYER" ] && printf "%s" "$ANI_CLI_PLAYER" && return 0 - command -v iina >/dev/null && printf "iina" && return 0 [ -e "/Applications/IINA.app/Contents/MacOS/iina-cli" ] && echo "/Applications/IINA.app/Contents/MacOS/iina-cli" && return 0 - dep_ch iina # exit with formating + printf "%s" "iina" && return 0 } where_mpv() { - command -v "$ANI_CLI_PLAYER" >/dev/null && printf "%s" "$ANI_CLI_PLAYER" && return 0 command -v "flatpak" >/dev/null && flatpak info io.mpv.Mpv >/dev/null 2>&1 && printf "%s" "flatpak_mpv" && return 0 - dep_ch mpv # exit with formating + printf "%s" "mpv" && return 0 } # SCRAPING @@ -339,17 +336,11 @@ download_dir="${ANI_CLI_DOWNLOAD_DIR:-.}" log_episode="${ANI_CLI_LOG:-1}" quality="${ANI_CLI_QUALITY:-best}" case "$(uname -a)" in - *Darwin*) # mac OS - player_function="$(where_iina)" - [ $? -eq 0 ] || exit $? - ;; + *Darwin*) player_function="${ANI_CLI_PLAYER:-$(where_iina)}" ;; # mac OS *ndroid*) player_function="${ANI_CLI_PLAYER:-android_mpv}" ;; # Android OS (termux) *MINGW* | *WSL2*) player_function="${ANI_CLI_PLAYER:-mpv.exe}" ;; # Windows OS *ish*) player_function="${ANI_CLI_PLAYER:-iSH}" ;; # iOS (iSH) - *) # Linux OS - player_function="${ANI_CLI_PLAYER:-$(where_mpv)}" - [ $? -eq 0 ] || exit $? - ;; + *) player_function="${ANI_CLI_PLAYER:-$(where_mpv)}" ;; # Linux OS esac no_detach="${ANI_CLI_NO_DETACH:-0}" @@ -444,8 +435,8 @@ case "$player_function" in download) dep_ch "ffmpeg" "aria2c" ;; android*) printf "\33[2K\rChecking of players on Android is disabled\n" ;; *iSH*) printf "\33[2K\rChecking of players on iOS is disabled\n" ;; - *iina*) true ;; # handled out of band in where_iina - *mpv*) true ;; # handled out of band in where_mpv + *IINA*) true ;; # handled out of band in where_iina + flatpak_mpv) true ;; # handled out of band in where_mpv *) dep_ch "$player_function" ;; esac From 5daa876a3c88544ee7a21aac4704e14be519c25a Mon Sep 17 00:00:00 2001 From: 9e4ed328ce2e8702c291c14f2471861a-255418 <professormagicae@tutamail.com> Date: Thu, 19 Sep 2024 09:10:59 +0200 Subject: [PATCH 09/19] docs: adjust formatting on readme line 554 (#1422) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 24fabf5a2..2f8d67a8f 100644 --- a/README.md +++ b/README.md @@ -551,7 +551,7 @@ Ani-skip uses the external lua script function of mpv and as such – for now * Can I change dub language? - No. * Can I change media source? - No (unless you can scrape that source yourself). * Can I use vlc? - Yes, use `--vlc` or `export ANI_CLI_PLAYER=vlc`. -* Can I adjust resolution? - `Yes, use -q resolution`, for example `ani-cli -q 1080`. +* Can I adjust resolution? - Yes, use `-q resolution`, for example `ani-cli -q 1080`. * How can I download? - Use `-d`, it will download into your working directory. * Can i change download folder? - Yes, set the `ANI_CLI_DOWNLOAD_DIR` to your desired location. * How can I bulk download? - `Use -d -e firstepisode-lastepisode`, for example `ani-cli onepiece -d -e 1-1000`. From 1ac228c391d158b02d0b38e20f896bd1151c056c Mon Sep 17 00:00:00 2001 From: Rushikesh Gaikwad <81632222+Wraient@users.noreply.github.com> Date: Wed, 9 Oct 2024 16:22:21 +0530 Subject: [PATCH 10/19] docs: add Curd to homies (#1437) --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 2f8d67a8f..a3222c6fc 100644 --- a/README.md +++ b/README.md @@ -573,3 +573,4 @@ Ani-skip uses the external lua script function of mpv and as such – for now * [redqu](https://github.com/port19x/redqu): A media centric reddit client (Clojure) * [doccli](https://github.com/TowarzyszFatCat/doccli): A cli to watch anime with POLISH subtitles (Python) * [GoAnime](https://github.com/alvarorichard/GoAnime): A CLI tool to browse, play, and download anime in Portuguese(Go) +* [Curd](https://github.com/Wraient/curd): A CLI tool to watch anime with Anilist, Discord RPC, Skip Intro Outro (Python) From e448f9d87484af95efbecda83e316d1afadd26ed Mon Sep 17 00:00:00 2001 From: Benedict Xavier <81157281+Benex254@users.noreply.github.com> Date: Thu, 10 Oct 2024 14:02:05 +0300 Subject: [PATCH 11/19] docs: add fastanime to homies (#1438) --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index a3222c6fc..0b1c458a5 100644 --- a/README.md +++ b/README.md @@ -574,3 +574,4 @@ Ani-skip uses the external lua script function of mpv and as such – for now * [doccli](https://github.com/TowarzyszFatCat/doccli): A cli to watch anime with POLISH subtitles (Python) * [GoAnime](https://github.com/alvarorichard/GoAnime): A CLI tool to browse, play, and download anime in Portuguese(Go) * [Curd](https://github.com/Wraient/curd): A CLI tool to watch anime with Anilist, Discord RPC, Skip Intro Outro (Python) +- [FastAnime](https://github.com/Benex254/FastAnime): browser anime experience from the terminal (Python) From 0b00c8885acde9129b1df70d3af42314b4a6e1f7 Mon Sep 17 00:00:00 2001 From: Skyler <81177923+Sarvasv-0@users.noreply.github.com> Date: Thu, 17 Oct 2024 12:24:32 +0530 Subject: [PATCH 12/19] refactor: allanime url update + re-adding the wixmp provider (#1410) Co-authored-by: port19 <port19@port19.xyz> --- ani-cli | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/ani-cli b/ani-cli index f56ff7041..412b0a3a6 100755 --- a/ani-cli +++ b/ani-cli @@ -1,6 +1,6 @@ #!/bin/sh -version_number="4.9.2" +version_number="4.9.3" # UI @@ -133,6 +133,13 @@ get_links() { |g' | sed -nE 's|.*link":"([^"]*)".*"resolutionStr":"([^"]*)".*|\2 >\1|p;s|.*hls","url":"([^"]*)".*"hardsub_lang":"en-US".*|\1|p')" case "$episode_link" in + *repackager.wixmp.com*) + extract_link=$(printf "%s" "$episode_link" | cut -d'>' -f2 | sed 's|repackager.wixmp.com/||g;s|\.urlset.*||g') + for j in $(printf "%s" "$episode_link" | sed -nE 's|.*/,([^/]*),/mp4.*|\1|p' | sed 's|,|\ +|g'); do + printf "%s >%s\n" "$j" "$extract_link" | sed "s|,[^/]*|${j}|g" + done | sort -nr + ;; *vipanicdn* | *anifastcdn*) if printf "%s" "$episode_link" | head -1 | grep -q "original.m3u"; then printf "%s" "$episode_link" @@ -158,9 +165,10 @@ provider_init() { # generates links based on given provider generate_link() { case $1 in - 1) provider_init "dropbox" "/Sak :/p" ;; # dropbox(mp4)(single) - 2) provider_init "wetransfer" "/Kir :/p" ;; # wetransfer(mp4)(single) - 3) provider_init "sharepoint" "/S-mp4 :/p" ;; # sharepoint(mp4)(single) + 1) provider_init "wixmp" "/Default :/p" ;; # wixmp(default)(m3u8)(multi) -> (mp4)(multi) + 2) provider_init "dropbox" "/Sak :/p" ;; # dropbox(mp4)(single) + 3) provider_init "wetransfer" "/Kir :/p" ;; # wetransfer(mp4)(single) + 4) provider_init "sharepoint" "/S-mp4 :/p" ;; # sharepoint(mp4)(single) *) provider_init "gogoanime" "/Luf-mp4 :/p" ;; # gogoanime(m3u8)(multi) esac [ -n "$provider_id" ] && get_links "$provider_id" @@ -184,7 +192,7 @@ get_episode_url() { resp=$(curl -e "$allanime_refr" -s -G "${allanime_api}/api" --data-urlencode "variables={\"showId\":\"$id\",\"translationType\":\"$mode\",\"episodeString\":\"$ep_no\"}" --data-urlencode "query=$episode_embed_gql" -A "$agent" | tr '{}' '\n' | sed 's|\\u002F|\/|g;s|\\||g' | sed -nE 's|.*sourceUrl":"--([^"]*)".*sourceName":"([^"]*)".*|\2 :\1|p') # generate links into sequential files cache_dir="$(mktemp -d)" - providers="1 2 3 4" + providers="1 2 3 4 5" for provider in $providers; do generate_link "$provider" >"$cache_dir"/"$provider" & done @@ -328,7 +336,7 @@ play() { # setup agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/121.0" -allanime_refr="https://allanime.to" +allanime_refr="https://allmanga.to" allanime_base="allanime.day" allanime_api="https://api.${allanime_base}" mode="${ANI_CLI_MODE:-sub}" From e5a8b95fb97fefc31b331d525470d59eb998dcc1 Mon Sep 17 00:00:00 2001 From: Berge della Hirsch <53668025+HirschBerge@users.noreply.github.com> Date: Thu, 17 Oct 2024 05:12:54 -0400 Subject: [PATCH 13/19] fix: Error logic and updated message and mis-escaped quotes (#1434) Co-authored-by: port19 <port19@port19.xyz> --- ani-cli | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/ani-cli b/ani-cli index 412b0a3a6..5ee93ca40 100755 --- a/ani-cli +++ b/ani-cli @@ -1,6 +1,6 @@ #!/bin/sh -version_number="4.9.3" +version_number="4.9.4" # UI @@ -201,7 +201,11 @@ get_episode_url() { links=$(cat "$cache_dir"/* | sed 's|^Mp4-||g;/http/!d;/Alt/d' | sort -g -r -s) rm -r "$cache_dir" episode=$(select_quality "$quality") - [ -z "$episode" ] && die "Episode not released!" + if printf "%s" "$ep_list" | grep -q "^$ep_no$"; then + [ -z "$episode" ] && die "Episode is released, but no valid sources!" + else + [ -z "$episode" ] && die "Episode not released!" + fi } # search the query and give results @@ -209,7 +213,7 @@ search_anime() { search_gql="query( \$search: SearchInput \$limit: Int \$page: Int \$translationType: VaildTranslationTypeEnumType \$countryOrigin: VaildCountryOriginEnumType ) { shows( search: \$search limit: \$limit page: \$page translationType: \$translationType countryOrigin: \$countryOrigin ) { edges { _id name availableEpisodes __typename } }}" curl -e "$allanime_refr" -s -G "${allanime_api}/api" --data-urlencode "variables={\"search\":{\"allowAdult\":false,\"allowUnknown\":false,\"query\":\"$1\"},\"limit\":40,\"page\":1,\"translationType\":\"$mode\",\"countryOrigin\":\"ALL\"}" --data-urlencode "query=$search_gql" -A "$agent" | sed 's|Show|\ -|g' | sed -nE "s|.*_id\":\"([^\"]*)\",\"name\":\"([^\"]*)\".*${mode}\":([1-9][^,]*).*|\1 \2 (\3 episodes)|p" +| g' | sed -nE "s|.*_id\":\"([^\"]*)\",\"name\":\"(.+)\",.*${mode}\":([1-9][^,]*).*|\1 \2 (\3 episodes)|p" | sed 's/\\"//g' } time_until_next_ep() { @@ -245,7 +249,7 @@ process_hist_entry() { update_history() { if grep -q -- "$id" "$histfile"; then - sed -E "s|^[^\t]+\t${id}\t[^\t]+$|${ep_no}\t${id}\t${title}|" "$histfile" >"${histfile}.new" + sed -E "s|^[^ ]+ ${id} [^ ]+$|${ep_no} ${id} ${title}|" "$histfile" >"${histfile}.new" else cp "$histfile" "${histfile}.new" printf "%s\t%s\t%s\n" "$ep_no" "$id" "$title" >>"${histfile}.new" From d82b7874aeac964f9520bdc46e63692969ff626d Mon Sep 17 00:00:00 2001 From: Vaishakh GK <vaishakhgk2006@gmail.com> Date: Thu, 17 Oct 2024 18:13:15 +0530 Subject: [PATCH 14/19] fix: remove hostname from uname output in OS detection (#1440) Co-authored-by: port19 <port19@port19.xyz> --- ani-cli | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ani-cli b/ani-cli index 5ee93ca40..5a65fe840 100755 --- a/ani-cli +++ b/ani-cli @@ -1,6 +1,6 @@ #!/bin/sh -version_number="4.9.4" +version_number="4.9.5" # UI @@ -347,7 +347,7 @@ mode="${ANI_CLI_MODE:-sub}" download_dir="${ANI_CLI_DOWNLOAD_DIR:-.}" log_episode="${ANI_CLI_LOG:-1}" quality="${ANI_CLI_QUALITY:-best}" -case "$(uname -a)" in +case "$(uname -a | cut -d " " -f 1,3-)" in *Darwin*) player_function="${ANI_CLI_PLAYER:-$(where_iina)}" ;; # mac OS *ndroid*) player_function="${ANI_CLI_PLAYER:-android_mpv}" ;; # Android OS (termux) *MINGW* | *WSL2*) player_function="${ANI_CLI_PLAYER:-mpv.exe}" ;; # Windows OS @@ -371,7 +371,7 @@ search="${ANI_CLI_DEFAULT_SOURCE:-scrape}" while [ $# -gt 0 ]; do case "$1" in -v | --vlc) - case "$(uname -a)" in + case "$(uname -a | cut -d " " -f 1,3-)" in *ndroid*) player_function="android_vlc" ;; MINGW* | *WSL2*) player_function="vlc.exe" ;; *ish*) player_function="iSH" ;; From f2e81120c076d5e56e2420a08e3310fc61b4c0f7 Mon Sep 17 00:00:00 2001 From: port19 <port19@port19.xyz> Date: Fri, 18 Oct 2024 08:29:51 +0200 Subject: [PATCH 15/19] chore: remove shell.nix and completions (#1443) --- _ani-cli-bash | 45 --------------------------------------------- _ani-cli-zsh | 30 ------------------------------ shell.nix | 22 ---------------------- 3 files changed, 97 deletions(-) delete mode 100644 _ani-cli-bash delete mode 100644 _ani-cli-zsh delete mode 100644 shell.nix diff --git a/_ani-cli-bash b/_ani-cli-bash deleted file mode 100644 index 7b1827e4b..000000000 --- a/_ani-cli-bash +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/bash - -_ani_cli_autocomplete() { - local cur prev opts - - # Get the current and previous words in the command line - COMPREPLY=() - cur="${COMP_WORDS[COMP_CWORD]}" - prev="${COMP_WORDS[COMP_CWORD-1]}" - - # Define the main options - opts=" - -c --continue - -d --download - -D --delete - -s --syncplay - -S --select-nth - -q --quality - -v --vlc - -V --version - -h --help - -e --episode - --dub - --rofi - --skip - --no-detach - -N --nextep-countdown - -U --update - " - - # Check for conditional options - if [[ "${COMP_WORDS[@]}" =~ "--no-detach" ]]; then - opts+=" --exit-after-play" - fi - - if [[ "${COMP_WORDS[@]}" =~ "-e" || "${COMP_WORDS[@]}" =~ "--episode" ]]; then - opts+=" -r --range" - fi - - # Use `compgen` to generate the options based on the current word - COMPREPLY=($(compgen -W "${opts}" -- "$cur")) -} - -# Register the completion function for `ani-cli` -complete -F _ani_cli_autocomplete ani-cli diff --git a/_ani-cli-zsh b/_ani-cli-zsh deleted file mode 100644 index 1ce3736f7..000000000 --- a/_ani-cli-zsh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/zsh - -# Enable autocompletion for zsh -autoload -U compinit && compinit - -_ani-cli() { - _arguments \ - '(-c --continue)'{-c,--continue}'[Continue watching from history]' \ - '(-d --download)'{-d,--download}'[Download the video instead of playing it]' \ - '(-D --delete)'{-D,--delete}'[Delete the downloaded video]' \ - '(-s --syncplay)'{-s,--syncplay}'[Use Syncplay to watch with friends]' \ - '(-S --select-nth)'{-S,--select-nth}'[Select nth entry]' \ - '(-q --quality)'{-q,--quality}'[Specify the video quality]' \ - '(-v --vlc)'{-v,--vlc}'[Use VLC to play the video]' \ - '(-V --version)'{-V,--version}'[Show the version of the script]' \ - '(-h --help)'{-h,--help}'[Show help this help message]' \ - '(-e --episode)'{-e,--episode}'[Specify the episode to watch]' \ - '(-e --episode)'{-r,--range}'[Specify the range of episodes to watch]' \ - '--dub[Dub the video]' \ - '--rofi[Use rofi instead of fzf]' \ - '--skip[Use ani-skip to skip the intro of the episode (mpv only)]' \ - "--no-detach[ Don't detach the player (useful for in-terminal playback, mpv only)]" \ - '(--no-detach)--exit-after-play[Exit after the video is played]' \ - '--skip-title[Use given title as ani-skip query]' \ - '(-N --nextep-countdown)'{-N,--nextep-countdown}'[Countdown to next episode]' \ - '(-U --update)'{-U,--update}'[Update the script]' -} - -# Register the completion function for `ani-cli` -compdef _ani-cli ani-cli diff --git a/shell.nix b/shell.nix deleted file mode 100644 index 5d1624704..000000000 --- a/shell.nix +++ /dev/null @@ -1,22 +0,0 @@ -{ - pkgs ? import <nixpkgs> {}, - withMpv ? true, - withVlc ? false, - withIina ? false, - chromecastSupport ? false, - syncSupport ? false -}: - -# To start the dev shell use the comment nix-shell -# use --arg withVlc true to use VLC -# use --arg withIina true to use Iina -# use --arg chromecastSupport true to use chromecastSupport -# use --arg syncSupport true to use syncSupport - -assert withMpv || withVlc || withIina; - -with pkgs; -mkShell { - name = "ani-cli dev shell"; - buildInputs = [ shfmt shellcheck (ani-cli.override ({ withMpv = withMpv; withVlc = withVlc; withIina = withIina; chromecastSupport = chromecastSupport; syncSupport = syncSupport; })).runtimeDependencies ]; -} From 63678868ebe6c2a32eebedbf7ccba9da039767f8 Mon Sep 17 00:00:00 2001 From: Rushikesh Gaikwad <81632222+Wraient@users.noreply.github.com> Date: Fri, 25 Oct 2024 22:26:10 +0530 Subject: [PATCH 16/19] docs: Update homies (Curd) detail (#1448) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0b1c458a5..b0634121c 100644 --- a/README.md +++ b/README.md @@ -573,5 +573,5 @@ Ani-skip uses the external lua script function of mpv and as such – for now * [redqu](https://github.com/port19x/redqu): A media centric reddit client (Clojure) * [doccli](https://github.com/TowarzyszFatCat/doccli): A cli to watch anime with POLISH subtitles (Python) * [GoAnime](https://github.com/alvarorichard/GoAnime): A CLI tool to browse, play, and download anime in Portuguese(Go) -* [Curd](https://github.com/Wraient/curd): A CLI tool to watch anime with Anilist, Discord RPC, Skip Intro Outro (Python) +* [Curd](https://github.com/Wraient/curd): A CLI tool to watch anime with Anilist, Discord RPC, Skip Intro/Outro/Filler/Recap (Go) - [FastAnime](https://github.com/Benex254/FastAnime): browser anime experience from the terminal (Python) From 0c0bf5bf3d3f664a6a9d11ba3b1df561fe87b4ca Mon Sep 17 00:00:00 2001 From: Maxwell Anderson <zaechus@pm.me> Date: Mon, 11 Nov 2024 00:38:18 -0700 Subject: [PATCH 17/19] docs: remove nix-shell section from contributing.md (#1453) --- CONTRIBUTING.md | 29 ----------------------------- 1 file changed, 29 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7e3919dec..7eeb31147 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -20,32 +20,3 @@ - Take part in troubleshooting and testing - Star the repo - Follow the maintainers - -## Development with nix - -When you develop with nix you can use the [dev shell](https://github.com/pystardust/ani-cli#nix-shell). - -To run the dev shell you can run the following command in the repository root: -```shell -nix-shell -``` - -The dev shell includes the following packages: -- runtime dependencies of ani-cli -- shfmt -- shellcheck - -Its also possible to use alternative packages for the video player or add features with this command: -```shell -nix-shell --arg <feature> true -``` -These are the packages available in the dev shell: -- `withVlc` -- `withIina` -- `chromecastSupport` -- `syncSupport` - -Just chain these commands together when you wanna multiple features for example: -```shell -nix-shell --arg withVlc true --arg chromecastSupport true -``` From 1b9e9bb2f298d54d7aca6408b16486b888c2e0ad Mon Sep 17 00:00:00 2001 From: Berge della Hirsch <53668025+HirschBerge@users.noreply.github.com> Date: Mon, 18 Nov 2024 06:52:15 -0500 Subject: [PATCH 18/19] fix: avoids reencoding the + while running time_until_next_ep (#1445) Co-authored-by: port19 <port19@port19.xyz> --- ani-cli | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ani-cli b/ani-cli index 5a65fe840..aa2b38ea1 100755 --- a/ani-cli +++ b/ani-cli @@ -1,6 +1,6 @@ #!/bin/sh -version_number="4.9.5" +version_number="4.9.6" # UI @@ -218,7 +218,7 @@ search_anime() { time_until_next_ep() { animeschedule="https://animeschedule.net" - curl -s -G "$animeschedule/api/v3/anime" --data-urlencode "q=$1" | sed 's|"id"|\n|g' | sed -nE 's|.*,"route":"([^"]*)","premier.*|\1|p' | while read -r anime; do + curl -s -G "$animeschedule/api/v3/anime" --data "q=$1" | sed 's|"id"|\n|g' | sed -nE 's|.*,"route":"([^"]*)","premier.*|\1|p' | while read -r anime; do data=$(curl -s "$animeschedule/anime/$anime" | sed '1,/"anime-header-list-buttons-wrapper"/d' | sed -nE 's|.*countdown-time-raw" datetime="([^"]*)">.*|Next Raw Release: \1|p;s|.*countdown-time" datetime="([^"]*)">.*|Next Sub Release: \1|p;s|.*english-title">([^<]*)<.*|English Title: \1|p;s|.*main-title".*>([^<]*)<.*|Japanese Title: \1|p') status="Ongoing" color="33" From 25959086230e9354cf96acc6d3a310d57f392221 Mon Sep 17 00:00:00 2001 From: Default Cube <56493793+Quicksilver151@users.noreply.github.com> Date: Tue, 10 Dec 2024 20:28:48 +0800 Subject: [PATCH 19/19] docs: spell check (#1463) --- README.md | 4 ++-- ani-cli | 6 +++--- hacking.md | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index b0634121c..23f700f0a 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ </p> <h3 align="center"> -A cli to browse and watch anime (alone AND with friends). This tool scrapes the site <a href="https://allanime.to/">allanime.</a> +A cli to browse and watch anime (alone AND with friends). This tool scrapes the site <a href="https://allmanga.to/">allmanga.</a> </h3> <h1 align="center"> @@ -562,7 +562,7 @@ Ani-skip uses the external lua script function of mpv and as such – for now ## Homies -* [animdl](https://github.com/justfoolingaround/animdl): Ridiculously efficient, fast and light-weight (supports most sources: allanime, zoro ... (Python) +* [animdl](https://github.com/justfoolingaround/animdl): Ridiculously efficient, fast and light-weight (supports most sources: allmanga, zoro ... (Python) * [jerry](https://github.com/justchokingaround/jerry): stream anime with anilist tracking and syncing, with discord presence (Shell) * [anipy-cli](https://github.com/sdaqo/anipy-cli): ani-cli rewritten in python (Python) * [Dantotsu](https://github.com/rebelonion/Dantotsu): Rebirth of Saikou, Best android app for anime/manga/LN with anilist integration (Kotlin) diff --git a/ani-cli b/ani-cli index aa2b38ea1..4d59379c0 100755 --- a/ani-cli +++ b/ani-cli @@ -155,7 +155,7 @@ get_links() { [ -z "$ANI_CLI_NON_INTERACTIVE" ] && printf "\033[1;32m%s\033[0m Links Fetched\n" "$provider_name" 1>&2 } -# innitialises provider_name and provider_id. First argument is the provider name, 2nd is the regex that matches that provider's link +# initialises provider_name and provider_id. First argument is the provider name, 2nd is the regex that matches that provider's link provider_init() { provider_name=$1 provider_id=$(printf "%s" "$resp" | sed -n "$2" | head -1 | cut -d':' -f2 | sed 's/../&\ @@ -332,7 +332,7 @@ play() { else play_episode fi - # moves upto stored positon and deletes to end + # moves up to stored position and deletes to end [ "$player_function" != "debug" ] && [ "$player_function" != "download" ] && tput rc && tput ed } @@ -496,7 +496,7 @@ esac # moves the cursor up one line and clears that line tput cuu1 && tput el -# stores the positon of cursor +# stores the position of cursor tput sc # playback & loop diff --git a/hacking.md b/hacking.md index f361a4dc7..e291a2e4e 100644 --- a/hacking.md +++ b/hacking.md @@ -3,7 +3,7 @@ Ani-cli is set up to scrape one platform - currently allanime. Supporting multip However ani-cli being open-source and the pirate anime streaming sites being so similar you can hack ani-cli to support any site that follows a few conventions. -## Prequisites +## Prerequisites Here's the of skills you'll need and the guide will take for granted: - basic shell scripting - understanding of http(s) requests and proficiency with curl @@ -33,7 +33,7 @@ An adblocker can help with reducing traffic from the site, but beware of extensi Once you have the pages (urls) that you're interested in, it's easier to inspect them from less/an editor. The debugger's inspector can help you with finding what's what but finding patterns/urls is much easier in an editor. -Additionally the debugger doesn't always show you the html faithfully - I've experineced some escape sequences being rendered, capitalization changing - so be sure you see the response of the servers in raw format before you write your regexes. +Additionally the debugger doesn't always show you the html faithfully - I've experienced some escape sequences being rendered, capitalization changing - so be sure you see the response of the servers in raw format before you write your regexes. ### Core concepts If you navigate the site normally from the browser, you'll see that each anime is represented with an URL that compromises from an ID (that identifies a series/season of series) and an episode number. @@ -50,7 +50,7 @@ Just try searching for a few series and see how the URL changes (most of the tim If the site uses a POST request or a more roundabout way, use the debugger to analyze the traffic. Once you figured out how searching works, you'll have to replicate it in the `search_anime` function. -The `curl` in this function is responsible for the search request, and the following `sed` regexes mold the respons into many lines of `id\ttitle` format. +The `curl` in this function is responsible for the search request, and the following `sed` regexes mold the response into many lines of `id\ttitle` format. The reason for this is the `nth` function, see it for more details. You'll have to change some variables in the process (eg. allanime_base) too. @@ -83,7 +83,7 @@ From here they are separated and parsed by `provider_init` and the first half on Some sites (like allanime) have these urls not in plaintext but "encrypted". The decrypt allanime function does this post-processing, it might need to be changed or discarded completely. If there's only one embed source, the `generate links..` block can be reduced to a single call to `generate_link`. -The current structure does the agregation of many providers asynchronously, but this is not needed if there's only one source. +The current structure does the aggregation of many providers asynchronously, but this is not needed if there's only one source. ### Extracting the media links