Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add --skip-title <title> #1253

Merged
merged 8 commits into from
Jan 3, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ Ani-skip uses the external lua script function of mpv and as such – for now

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

## Homies

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

version_number="4.7.2"
version_number="4.7.3"

# UI

Expand Down Expand Up @@ -65,15 +65,18 @@ help_info() {
Use rofi instead of fzf for the interactive menu
--skip
Use ani-skip to skip the intro of the episode (mpv only)
--skip-title <title>
Use given title as ani-skip query
-U, --update
Update the script
Some example usages:
%s -q 720p banana fish
%s --skip --skip-title \"one piece\" -S 2 one piece
%s -d -e 2 cyberpunk edgerunners
%s --vlc cyberpunk edgerunners -q 1080p -e 4
%s blue lock -e 5-6
%s -e \"5 6\" blue lock
\n" "${0##*/}" "${0##*/}" "${0##*/}" "${0##*/}" "${0##*/}" "${0##*/}" "${0##*/}" "${0##*/}"
\n" "${0##*/}" "${0##*/}" "${0##*/}" "${0##*/}" "${0##*/}" "${0##*/}" "${0##*/}" "${0##*/}" "${0##*/}"
exit 0
}

Expand Down Expand Up @@ -239,7 +242,8 @@ download() {
}

play_episode() {
[ "$skip_intro" = 1 ] && skip_flag="$(ani-skip "$title" "$ep_no")"
aniskip_title="${skip_title:-${title}}"
[ "$skip_intro" = 1 ] && skip_flag="$(ani-skip "$aniskip_title" "$ep_no")"
[ -z "$episode" ] && get_episode_url
# shellcheck disable=SC2086
case "$player_function" in
Expand Down Expand Up @@ -313,6 +317,7 @@ esac

use_external_menu="${ANI_CLI_EXTERNAL_MENU:-0}"
skip_intro="${ANI_CLI_SKIP_INTRO:-0}"
skip_title="$ANI_CLI_SKIP_TITLE"
LeFlorians marked this conversation as resolved.
Show resolved Hide resolved
[ -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 @@ -367,6 +372,10 @@ while [ $# -gt 0 ]; do
--dub) mode="dub" ;;
--rofi) use_external_menu=1 ;;
--skip) skip_intro=1 ;;
--skip-title)
[ $# -lt 2 ] && die "missing argument!"
skip_title="$2"
shift ;;
LeFlorians marked this conversation as resolved.
Show resolved Hide resolved
-U | --update) update_script ;;
*) query="$(printf "%s" "$query $1" | sed "s|^ ||;s| |+|g")" ;;
esac
Expand Down
6 changes: 6 additions & 0 deletions ani-cli.1
LeFlorians marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ 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)
.TP
\fB\--skip-title\fR \fI\,<title>\/\fR
Specify the title to use for ani-skip
.PP
.SH
ENVIRONMENT VARIABLES
Expand Down Expand Up @@ -95,6 +98,9 @@ Controls the default source. Valid is history (equivalent to -c), everything els
.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.
.TP
\fBANI_CLI_SKIP_TITLE\fR
Overrides the anime title to query for skip times. Can be any string value. Default is empty, resolving to the anime title as given by ani-cli.
.PP
.SH EPISODE SELECTION
.PP
Expand Down
Loading