feat: keep ongoing anime selectable in -c and integrate nextep countdown - #1707
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
|
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 |
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 |
|
This is on my radar again |
I prefer the shell-idiom, as discussed earlier.
This was not contested.
This review is blocking the merge rn
* docs: add ubuntu touch installation instructions (#1780) * feat: keep ongoing anime selectable in -c and integrate nextep countdown (#1707) Co-authored-by: port19 <port19@port19.xyz> * fix: fixed regex for status and countdown times (#1717) Co-authored-by: port19 <port19@port19.xyz> * docs: fix accidental dead link in #1780 (#1786) * fix: escape sed special chars in update_history to handle & in titles (#1619) Co-authored-by: port19 <port19@port19.xyz> * feat: added year aired to results view (#1784) Co-authored-by: port19 <port19@port19.xyz> * feat: add Homebrew formula for easier installation on macOS (#1782) Signed-off-by: botantony <antonsm21@gmail.com> * test(red): cover the year suffix ani-cli 4.14.5 appends to titles Upstream search results changed from "Title (N episodes)" to "Title (N episodes) (YYYY)", and update_history stores that display title verbatim in ani-hsts. The history resolver's episode-tail regex is end-anchored and the search-line parser assumes the episode count is the last parenthetical, so both miss the new shape. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(green): tolerate the year suffix ani-cli 4.14.5 appends to titles The history resolver's episode-tail regex now accepts an optional trailing all-digit parenthetical after "(N episodes)" and strips both, so courSize extraction, search-title stripping, and title plausibility checks keep working on rows the new ani-cli writes. The search-line parser peels the year group off before locating the episode count. Old-format rows parse unchanged on both paths. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * test: model ani-cli 4.14.5 output in allanime fixtures and bats suites The search fixture gains the airedStart field the new search selection requests — without it the 4.14.5 result sed matches nothing, which broke the acceptance suite and the Rust progress-line drift detector against the real script. Expectations move to the "(N episodes) (YYYY)" format, process_hist_entry's new up-to-date line and year-preserving count refresh are covered, and update_history gets a case locking in the upstream sed-escape fix for ampersands in titles. All updated behaviors were verified by sourcing the merged script directly, since bats' pass/fail signal for lib-sourcing tests is currently unreliable (see the follow-up on source_ani_cli_lib disabling errexit and the ERR trap). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * test(red): search results without an airedStart year must survive allmanga returns airedStart: null for older and stub rows (the GUI scraper models exactly that as None), and ani-cli 4.14.5's result sed silently drops such rows. The GUI chooses a candidate from its own full scraper list and passes a 1-based -S index into ani-cli, so a dropped row makes that show unplayable and shifts every later index onto the wrong anime. The fixture gains a no-year stub edge that must come through in the pre-4.14.5 shape. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(green): keep no-year allanime rows in ani-cli search results Adds a fallback sed expression to the vendored script's search_anime that emits rows without an airedStart year in the pre-4.14.5 shape (no year suffix) instead of dropping them; a t branch keeps year-carrying rows on the upstream format. This preserves 1:1 index parity with the GUI's native scraper list, which the play path relies on when passing -S. Second intentional divergence from upstream, alongside the __ANI_CLI_LIB__ source guard. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * test(red): search rows with escaped quotes in the title must survive ani-cli 4.14.5 tightened the name capture from the old greedy form to a no-quotes character class, so a title containing an escaped double quote stops the match and the row is dropped before the final unescape sed runs — shifting the GUI's -S index like the no-year drop did. The fixture gains a quoted-title edge that must come through unescaped. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(green): restore the greedy title capture in search_anime Both result expressions capture the name with the greedy (.+) upstream used before 4.14.5 instead of [^\"]*, so titles containing escaped quotes match again and stay in the list; the trailing sed strips the escapes from the display form as it always has. Greedy backtracking still lands on the closing quote-comma boundary because every other field in the record is numeric. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * test(red): failed episode lookups must not emit an up-to-date row ani-cli 4.14.5's process_hist_entry falls through to the "(up to date)" line whenever the next-episode lookup is empty — including when episodes_list returned nothing (transient failure; the row then carries a blank latest episode and a corrupted count) or no longer contains the saved episode (the shown latest is unrelated to what the user watched). Both cases must print nothing. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(green): only mark history entries up to date on a real lookup process_hist_entry remembers the saved episode before the next-episode lookup overwrites it, and the up-to-date fallback now requires a non-empty episode list that actually contains that episode. Transient episodes_list failures and stale saved episodes print nothing instead of a selectable row with a blank or unrelated latest episode. Third fork patch on the vendored script, marked inline like the others. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> --------- Signed-off-by: botantony <antonsm21@gmail.com> Co-authored-by: ChromiumOS-Guy <57168079+ChromiumOS-Guy@users.noreply.github.com> Co-authored-by: Sumon Sourabh Ghosh <88110131+sghoshm@users.noreply.github.com> Co-authored-by: port19 <port19@port19.xyz> Co-authored-by: beatle <118904398+buggedbeatle998@users.noreply.github.com> Co-authored-by: Sascha Buehrle <47737812+saschabuehrle@users.noreply.github.com> Co-authored-by: Aaron Campbell <aaron@keydesign.com> Co-authored-by: Anton Melnikov <antonsm21@gmail.com> Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
…own (pystardust#1707) Co-authored-by: port19 <port19@port19.xyz>



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