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 flag to allow adding an new anime to the histfile #1332

Closed
wants to merge 4 commits into from

Conversation

0WN463
Copy link
Contributor

@0WN463 0WN463 commented May 11, 2024

Pull Request Template

Type of change

  • Bug fix
  • Feature
  • Documentation update

Description

A use case that I frequently have is that I want to add an anime to my histfile so that I can watch it later.
This PR adds a flag -a/--add which allows us to simply add the anime without playing the episode.

For these animes, we use unwatched to signify the "ep_no" field in the histfile.
When parsing the histfile, we select the first episode in the episode list

This flag only significant in the case of using -c later.
Standard operations of ani-cli have no interaction with this flag.

PS: I tried running shfmt, but it is flagging a lot of changes in the latest master

Checklist

  • any anime playing
  • bumped version

  • next, prev and replay work
  • -c history and continue work
  • -d downloads work
  • -s syncplay works
  • -q quality works
  • -v vlc works
  • -e select episode works
  • -S select index works
  • -r range selection works
  • --skip ani-skip works
  • --skip-title ani-skip title argument works
  • --no-detach no detach works
  • --dub and regular (sub) mode both work
  • all providers return links (not necessarily on a single anime, use debug mode to confirm)

  • -h help info is up to date
  • Readme is up to date
  • Man page is up to date

Additional Testcases

  • The safe bet: One Piece
  • Episode 0: Saenai Heroine no Sodatekata ♭
  • Unicode: Saenai Heroine no Sodatekata ♭
  • Non-whole episodes: Tensei shitara slime datta ken (ep. 24.5, ep. 24.9)

@0WN463 0WN463 changed the title Add flag to allow adding an new anime to the histfile feat: Add flag to allow adding an new anime to the histfile May 11, 2024
@@ -432,8 +452,7 @@ case "$search" in
resfile="$(mktemp)"
grep "$result" "$histfile" >"$resfile"
read -r ep_no id title <"$resfile"
ep_list=$(episodes_list "$id")
ep_no=$(printf "%s" "$ep_list" | sed -n "/^${ep_no}$/{n;p;}") 2>/dev/null
process_hist_entry
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems line L435 and 436 is actually duplicating process_hist_entry

@port19x
Copy link
Collaborator

port19x commented May 14, 2024

I kinda get it, but I don't think this feature is desirable to a broader audience

@port19x port19x closed this May 14, 2024
@0WN463
Copy link
Contributor Author

0WN463 commented May 18, 2024

Why not though?

We do have the -D, --delete flag, which only deletes the history, so we do consider user flows which uses the history.
The delete flag only makes sense in the history-based flow, so it means we are support this flow.

So I feel that it makes sense to bolster the history-based flow by adding this feature.

@Derisis13
Copy link
Collaborator

This feature is not that bad, but the implementation was way too many loc. @port19x would you be against it if it were below 15 lines total?

@port19x
Copy link
Collaborator

port19x commented May 27, 2024

We most definitely support history based flow, but I believe it's unwise to let ani-cli feature-creep into a local anilist equivalent.
We can add it if derisis sees value, especially if we get it down to say +20 loc

@71zenith
Copy link
Collaborator

+1
This is a bit too niche of a feature, i doubt anyone would be deep into this workflow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants