Skip to content

Commit

Permalink
feat: added support for ani-skip to skip episode intros (#1231)
Browse files Browse the repository at this point in the history
Co-authored-by: Aaron Züger <[email protected]>
  • Loading branch information
azureorangexyz and Aaron Züger authored Nov 30, 2023
1 parent 67b9906 commit 4a77bca
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ A cli to browse and watch anime (alone AND with friends). This tool scrapes the
- [From Source](#installing-from-source)
- [Uninstall](#uninstall)
- [Dependencies](#dependencies-1)
- [Ani-Skip](#ani-skip)
- [Homies](#homies)
- [Contribution Guidelines](./CONTRIBUTING.md)
- [Disclaimer](./disclaimer.md)
Expand Down Expand Up @@ -400,6 +401,19 @@ apk del grep sed curl fzf git aria2 ffmpeg ncurses
- yt-dlp - m3u8 Downloader
- ffmpeg - m3u8 Downloader (fallback)
- fzf - User interface
- ani-skip (optional)

### Ani-Skip

Ani-skip is a script to automatically skip anime opening sequences, making it easier to watch your favorite shows without having to manually skip the intros each time (from the original [README](https://github.com/synacktraa/ani-skip/tree/master#a-script-to-automatically-skip-anime-opening-sequences-making-it-easier-to-watch-your-favorite-shows-without-having-to-manually-skip-the-intros-each-time)).

For install instructions visit [ani-skip](https://github.com/synacktraa/ani-skip).

Ani-skip uses the external lua script function of mpv and as such – for now – only works with mpv.

**Warning:** For now, ani-skip does **not** seem to work under Windows.

**Note:** It may be, that ani-skip won't know the anime you're trying to watch (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)).

## Homies

Expand Down
11 changes: 9 additions & 2 deletions ani-cli
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh

version_number="4.6.2"
version_number="4.7.0"

# UI

Expand Down Expand Up @@ -63,6 +63,8 @@ help_info() {
Play dubbed version
--rofi
Use rofi instead of fzf for the interactive menu
--skip
Use ani-skip to skip the intro of the episode (mpv only)
-U, --update
Update the script
Some example usages:
Expand Down Expand Up @@ -237,13 +239,15 @@ download() {
}

play_episode() {
[ "$skip_intro" = 1 ] && skip_flag="$(ani-skip "$title" "$ep_no")"
[ -z "$episode" ] && get_episode_url
# shellcheck disable=SC2086
case "$player_function" in
debug)
[ -z "$ANI_CLI_NON_INTERACTIVE" ] && printf "All links:\n%s\nSelected link:\n" "$links"
printf "%s\n" "$episode"
;;
mpv*) nohup "$player_function" --force-media-title="${allanime_title}Episode ${ep_no}" "$episode" >/dev/null 2>&1 & ;;
mpv*) nohup "$player_function" $skip_flag --force-media-title="${allanime_title}Episode ${ep_no}" "$episode" >/dev/null 2>&1 & ;;
android_mpv) nohup am start --user 0 -a android.intent.action.VIEW -d "$episode" -n is.xyz.mpv/.MPVActivity >/dev/null 2>&1 & ;;
android_vlc) nohup am start --user 0 -a android.intent.action.VIEW -d "$episode" -n org.videolan.vlc/org.videolan.vlc.gui.video.VideoPlayerActivity -e "title" "${allanime_title}Episode ${ep_no}" >/dev/null 2>&1 & ;;
iina) nohup "$player_function" --no-stdin --keep-running --mpv-force-media-title="${allanime_title}Episode ${ep_no}" "$episode" >/dev/null 2>&1 & ;;
Expand Down Expand Up @@ -308,6 +312,7 @@ case "$(uname -a)" in
esac

use_external_menu="${ANI_CLI_EXTERNAL_MENU:-0}"
skip_intro="${ANI_CLI_SKIP_INTRO:-0}"
[ -t 0 ] || use_external_menu=1
hist_dir="${ANI_CLI_HIST_DIR:-${XDG_STATE_HOME:-$HOME/.local/state}/ani-cli}"
[ ! -d "$hist_dir" ] && mkdir -p "$hist_dir"
Expand Down Expand Up @@ -361,6 +366,7 @@ while [ $# -gt 0 ]; do
;;
--dub) mode="dub" ;;
--rofi) use_external_menu=1 ;;
--skip) skip_intro=1 ;;
-U | --update) update_script ;;
*) query="$(printf "%s" "$query $1" | sed "s|^ ||;s| |+|g")" ;;
esac
Expand All @@ -370,6 +376,7 @@ done
[ "$use_external_menu" = "1" ] && multi_selection_flag="${ANI_CLI_MULTI_SELECTION:-"-multi-select"}"
printf "\33[2K\r\033[1;34mChecking dependencies...\033\n[0m"
dep_ch "curl" "sed" "grep" || true
[ "$skip_intro" = 1 ] && (dep_ch "ani-skip" || true)
if [ -z "$ANI_CLI_NON_INTERACTIVE" ]; then dep_ch fzf || true; fi
case "$player_function" in
debug) ;;
Expand Down
6 changes: 6 additions & 0 deletions ani-cli.1
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ Play the dubbed version. Without this flag, it'll always play the subbed version
.TP
\fB\--rofi\fR
Use rofi instead of fzf for the interactive menu
.TP
\fB\--skip\fR
Use ani-skip to skip the intro of the episode (mpv only)
.PP
.SH
ENVIRONMENT VARIABLES
Expand Down Expand Up @@ -89,6 +92,9 @@ Controls the directory ani-cli uses for storing history. A /ani-cli subfolder is
.TP
\fBANI_CLI_DEFAULT_SOURCE\fR
Controls the default source. Valid is history (equivalent to -c), everything else means search. Default is search.
.TP
\fBANI_CLI_SKIP_INTRO\fR
Controls if ani-skip is used to skip intros (works with mpv only). Can be 0 (disabled) or 1 (enabled). Default is 0.
.PP
.SH EPISODE SELECTION
.PP
Expand Down

0 comments on commit 4a77bca

Please sign in to comment.