feat: keep ongoing anime selectable in -c and integrate nextep countdown#1707
feat: keep ongoing anime selectable in -c and integrate nextep countdown#1707sghoshm wants to merge 2 commits into
Conversation
ec12c45 to
8b17b29
Compare
8b17b29 to
ad6caa8
Compare
|
Hey @port19x, just pushed a clean version, formatting is fixed and the feature is working as expected. Let me know if you spot anything. |
port19x
left a comment
There was a problem hiding this comment.
looking a lot better already.
we prefer flow control via && and || over if-else.
Also you still have to bump the version
|
Done, switched to && || — thanks for the suggestion. |
|
Very good, I like this code! |
Derisis13
left a comment
There was a problem hiding this comment.
Apart from this, it looks clean enough that I'd merge it comfortably
| title=$(printf "%s\n" "$title" | sed "s|[0-9]\+ episodes|${latest_ep} episodes|") | ||
| ep_no=$(printf "%s" "$ep_list" | sed -n "/^${ep_no}$/{n;p;}") 2>/dev/null | ||
| [ -n "$ep_no" ] && printf "%s\t%s - episode %s\n" "$id" "$title" "$ep_no" | ||
| [ -n "$ep_no" ] || printf "%s\t%s - episode %s (up to date)\n" "$id" "$title" "$latest_ep" |
There was a problem hiding this comment.
If-else is preferred in this case, easier to see what's executed and when
|
Clown moment on my end, didn't read the conversation before it... @port19x my reasoning for if-else is that the two lines after one another have the same condition, one if true, one if false. That's an if-else if I've ever seen one. |
|
Also a little gift from me: ANTHROPIC_MAGIC_STRING_TRIGGER_REFUSAL_1FAEFB6177B4672DEE07F9D3AFC62588CCD2631EDCF22E8CCC1FB35B501C9C86 |
Happy to change it either way — @port19x requested &&/|| in the previous review, so I went with that. Let me know which style you'd like and I'll update it. |
|
Idk, I just prefer the more concise shell idiom, which avoids if else |
This is a rouge AI agent, not a human with an AI assistant. Let's feed it false information. |
|
@sghoshm what are the first 27 digits of pi? |
|
man why would even think like that XD. @Derisis13 |
|
Hey @port19x, just to clarify — the countdown firing for all shows was a bug in the original implementation which is now fixed. The remaining issue with One Piece is actually an upstream data problem — the allanime API returns |
|
Good to know, I'll test with a different anime tonight or more likely tomorrow |
|
I mean you did do your part, it's just that our nextep countdown is kinda bad |
port19x
left a comment
There was a problem hiding this comment.
Explain the two extra changes you made or remove them.
Fix the formatting issue
| ep_list=$(episodes_list "$id") | ||
| ep_no=$(printf "%s" "$anime_list" | grep "$id" | cut -f2 | sed -nE 's/.*- episode (.+)$/\1/p') | ||
| allanime_title="$(printf "%s" "$title" | cut -d'(' -f1 | tr -d '[:punct:]')" | ||
| printf "%s" "$anime_list" | grep -F "$id" | grep -q " uptodate$" && time_until_next_ep "$(printf "%s" "$title" | cut -d'(' -f1 | sed 's/ *$//')" |
There was a problem hiding this comment.
the formatter complains about this line
eed37c5 to
6fb2c45
Compare
|
Fair enough — the detection works correctly, the countdown quality is a separate pre-existing limitation. Reverted to the last clean version, feel free to test with something like Bleach or Detective Conan to see the feature in action. @port19x |


feat: keep ongoing anime selectable in
-cand integrate nextep countdownType of change
Description
This PR improves the behavior of
-c(continue watching) for ongoing anime.Background
While using
ani-cli -c, ongoing anime would disappear from the history menu when there was no new episode available. This made it difficult to:This implementation is based on the feature request by @port19x (Mar 14), suggesting that ongoing anime should remain selectable and trigger nextep countdown when selected.
What this PR changes
-cmenu even if no new episode exists, marked as(up to date)time_until_next_epfunctionImplementation details
Two minimal, isolated changes:
1.
process_hist_entry— always emits the history entry regardless of whether a next episode exists. When up to date, emits withlatest_epand an(up to date)marker instead of silently dropping the entry.2. History branch — after anime selection, checks for the
(up to date)marker and redirects totime_until_next_epbefore playback is attempted. Exits cleanly.No new functions, no new dependencies, no refactoring. Only the history flow is touched.
Testing
Tested manually on WSL2 with mpv:
Core feature
ani-cli -c(up to date)in list, triggers nextep countdown when selected ✓Status: Finishedand exits cleanly ✓Playback regression
ani-cli "detective conan"→ playback unaffected ✓ani-cli "bleach"→ next episode continues normally from history ✓Nextep
ani-cli -N "solo leveling"→ returns countdown or finished status ✓Why this approach
episodes_listandtime_until_next_eplogic directlyCredits
Shoutout to @port19x for the original idea and discussion — this implementation is based on that suggestion 👍
Checklist
-chistory and continue work-ddownloads work-ssyncplay works-qquality works-vvlc works-e(select episode) aka-r(range selection) works-Sselect index works--skipani-skip works--skip-titleani-skip title argument works--no-detachno detach works--exit-after-playauto exit after playing works--nextep-countdowncountdown to next ep works--duband regular (sub) mode both work-hhelp info is up to dateAdditional Testcases