Skip to content

Commit ebb1bdd

Browse files
port19xThisTakencodex71zenith
authored
feat: support first available episode in ranges (#1859)
Co-authored-by: ThisTaken <91387689+ThisTaken@users.noreply.github.com> Co-authored-by: OpenAI Codex <codex@openai.com> Co-authored-by: zen <71zenith@proton.me>
1 parent 92e9d79 commit ebb1bdd

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

ani-cli

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/sh
22

3-
version_number="5.0.2"
3+
version_number="5.0.3"
44

55
# UI
66

@@ -161,7 +161,7 @@ anidb_search() {
161161
[ "$curl_exe" = "curl" ] && die "Blocked by cloudflare. Try installing curl-impersonate"
162162
die "Blocked by cloudflare."
163163
fi
164-
printf "%s" "$_page" | sed -nE 's|.*anime/([a-z0-9-]+-[0-9]+)".*alt="([^"]+)".*|\1\t\2|p' | sed -e "s|&#039;|'|g" -e 's|&quot;|"|g'
164+
printf "%s" "$_page" | sed -nE 's|.*anime/([a-z0-9-]+-[0-9]+)".*alt="([^"]+)".*|\1\t\2|p' | sed -e "s|&#039;|'|g" -e 's|&quot;|"|g' -e "s|&amp;|\&|g"
165165
}
166166

167167
# extract mal_id and seasons metadata
@@ -351,6 +351,7 @@ play() {
351351
_end=$(printf "%s" "$ep_no" | grep -Eo '(-1|[0-9]+(\.[0-9]+)?)$')
352352
[ "$_start" = "-1" ] && ep_no=$(printf "%s" "$ep_list" | tail -n 1) && unset _start
353353
[ -z "$_end" ] || [ "$_end" = "$_start" ] && unset _start _end
354+
[ "$_start" = "0" ] && _start=$(printf "%s" "$ep_list" | head -n 1)
354355
[ "$_end" = "-1" ] && _end=$(printf "%s" "$ep_list" | tail -n 1)
355356
_line_count=$(printf "%s\n" "$ep_no" | wc -l | tr -d "[:space:]")
356357
if [ "$_line_count" != 1 ] || [ -n "$_start" ]; then

ani-cli.1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ This tool scrapes the site anidb.
1717
.SH OPTIONS
1818
.TP
1919
\fB\-e | --episode | -r | --range\fR \fI\,<episode>\/\fR
20-
Specify the episode numbers to watch. If range is specified it should be quoted or separated by a non-numeric character (eg. -).
20+
Specify the episode numbers to watch. If a range is specified, it should be quoted or separated by a non-numeric character (e.g. -). Use 0 for the first available episode and -1 for the last.
2121
.TP
2222
\fB\-c | --continue\fR
2323
Continue watching anime from history.

0 commit comments

Comments
 (0)