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

ani-cli V4 #955

Merged
merged 40 commits into from Jan 24, 2023
Merged

ani-cli V4 #955

merged 40 commits into from Jan 24, 2023

Conversation

port19x
Copy link
Collaborator

@port19x port19x commented Dec 25, 2022

Pull Request Template

Type of change

Rewrite
closes #948

Description

V4 will be a full rewrite, using scraping code written by @CoolnsX and ui/ux code written by @justchokingaround

This will help us pay off the technical debt that has accumulated in ani-cli over the past one and a half year and will let us implement what we learned from experience.
It might even chop our LOC in half.

For users the most significant change will be the introduction of a fully fzf based UI.
We will also make sure that our core features, such as our deep history integration and syncplay support, stay and maybe get even more plentiful in the process.

Checklist

  • any anime playing
  • bumped version
  • next, prev and replay work
  • quality works
  • downloads work
  • quality works with downloads
  • select episode -a and rapid resume work
  • syncplay -s works
  • autoplay, aka range selection, works

Additional Testcases

  • The safe bet: One Piece
  • Episode 0: Saenai Heroine no Sodatekata ♭
  • Unicode: Saenai Heroine no Sodatekata ♭
  • Not uploaded: one piece dub episode 590
  • Unreleased: soredemo ayumu wa yosetekuru
  • Short id (for decryption): Log Horizon episode 1-2

@Derisis13
Copy link
Collaborator

What have I done...

ani-cli Outdated
printf "Selected link:\n%s\n" "$episode"
;;
mpv | iina)
nohup "$player_function" --force-media-title="${allanime_title}episode-${ep_no}-${mode}" "$episode" > /dev/null &

Choose a reason for hiding this comment

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

consider removing the "&" at the end
I don't see a reason the menu should be shown when something is already playing and you can't interact with the player when rofi is open if you're using external menu

Copy link
Collaborator

Choose a reason for hiding this comment

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

Detaching from the main process is useful not only because this is the behaviour everyone got used to but this way the script's process can exit, and the player will stay open. I don't see a reason why we shouldn't.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Then I saw how rofi works and I totally take back what I said. This commit should address the matter

@Derisis13
Copy link
Collaborator

Derisis13 commented Dec 30, 2022

What we're missing so far:

  • logging watched/to be watched to history
  • resume from history (compatible or with hist_transition)
  • range selection
  • making the UI pretty (we can make this maybe into a next version)
  • help text
  • self-update
  • dependency self-check
  • argument parsing
  • android compatibility
  • solving why it isn't working on windows

Tick off the list what you have implemented

ani-cli Outdated
-s | --syncplay) player_function=syncplay && shift ;;
-q | --quality) quality="$2" && shift 2 ;;
-c | --continue) search=history && shift ;;
-d | --download) player_function=download && shift ;;
-v | -V | --version) version_info ;;
Copy link
Collaborator

@Derisis13 Derisis13 Jan 2, 2023

Choose a reason for hiding this comment

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

I'd actually prefer if -v and -V would be used for vlc, as I think that function is used more frequently. Also I'd consider supporting case insensitive arguments for all other options, bc it requires no extra loc (but I'm open on this)

Copy link
Collaborator

Choose a reason for hiding this comment

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

good idea for vlc, will change that in the next commit. added long options in 3b19f3a

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Especially -v needs to me vlc.
-V is conventionally a shorthand for --version.
Would also make sense with the heuristic that uppercase makes stuff outside the script.

ani-cli Outdated Show resolved Hide resolved
@port19x
Copy link
Collaborator Author

port19x commented Jan 3, 2023

I'll be overhauling the readme at my earliest convenience

ani-cli Outdated
player_function="${ANI_CLI_PLAYER:-flatpak_mpv}"
else
player_function="${ANI_CLI_PLAYER:-mpv}"
fi ;;
Copy link
Collaborator

Choose a reason for hiding this comment

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

since having flatpak mpv support is useful outside of steamdeck users (unlike iina, which is OSX only and unlike am launch which is android only) I'd consider making it an argument rather than dependant on the platform string

Copy link
Contributor

Choose a reason for hiding this comment

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

We can default to mpv.
If it is not found check for flatpak mpv and use it if found.
In my opinion it would be easier for users. It shouldnt be a problem because both pacage managers have the same version and no exclusive features, so it makes no sense to have both installed at the same time.

ani-cli Outdated
if flatpak info io.mpv.Mpv 2>&1 | grep -q 'error'; then
die "Program \"$dep\" not found. Please install it."
fi
fi
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't understand the logic here, it appears to me that you check for flatpak mpv whenever any dependency is missing. This would be bad because if flatpak mpv is present, it would mask out a missing dependency, eg. grep.
I'm afraid flatpak programs need to be handled separately, if I understand this correctly

Copy link
Contributor

Choose a reason for hiding this comment

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

oh, you are right. Its a bad code

@MrSmoer
Copy link

MrSmoer commented Jan 4, 2023

Could also you add line numbers to the search results? V4 is awesome, thanks for your work!

@port19x
Copy link
Collaborator Author

port19x commented Jan 5, 2023

Could also you add line numbers to the search results? V4 is awesome, thanks for your work!

Should be pretty easy. We'd just need to pipe through nl before the fzf output

@port19x
Copy link
Collaborator Author

port19x commented Jan 5, 2023

I'd like to not squash all the commits into one when merging to master this time.
Instead I'm proposing that I squash the commits to sensible chunks and then add the whole maintainership team as coauthors via the commit message.
The coauthorship is kind of a gimmick, but accurately reflects our collaborative development process imo.
On top of that, it will give all of us Pair Extraordinaire x3.
That would also contribute to the github achievements research done by schweinepriester

Objections?

@port19x port19x marked this pull request as ready for review January 5, 2023 09:53
@justchokingaround
Copy link
Collaborator

im in favor

@port19x
Copy link
Collaborator Author

port19x commented Jan 5, 2023

Seeing as basic functionality works now and most rough edges are smoothed out I'd like to invite testing by the broader userbase. Ready for review

@Terraro53
Copy link

Terraro53 commented Jan 5, 2023

Trying to use iina on MacOS results in:"Error Cannot open file or stream"
looking back at previous version, iina had --no-stdin and --keep-running passed.
However I've found only --no-stdin is necessary.
As such
` play_episode() {

...
mpv) nohup "$player_function" --force-media-title="${allanime_title}episode-${ep_no}-${mode}" "$episode" >/dev/null 2>&1 & ;;
iina) nohup "$player_function" --no-stdin --force-media title="${allanime_title}episode-${ep_no}-${mode}" "$episode" >/dev/null 2>&1 & ;;
...`
Fixes this

@Derisis13
Copy link
Collaborator

Derisis13 commented Jan 5, 2023

Seeing as basic functionality works now and most rough edges are smoothed out I'd like to invite testing by the broader userbase. Ready for review

No, not ready. Android is broken, history is missing. I'm against releasing incomplete code. This is a volunteer project, there are no deadlines so we should take our time. It'll be worth it for all the issues we won't get because of the incomplete state.

A compromise could be to update the readme with a statement of v4, instructions on how to upgrade and a list of features still missing.

@port19x port19x marked this pull request as draft January 5, 2023 15:04
@port19x
Copy link
Collaborator Author

port19x commented Jan 5, 2023

history is missing

Uh, nvm then.
Thats a pretty major feature.
I'd be fine with android support being implemented parallel to general review, but history is a pretty significant hole in out featureset

@avecpps
Copy link

avecpps commented Jan 5, 2023

Will V4 support watching the dubbed versions of shows?

@CoolnsX
Copy link
Collaborator

CoolnsX commented Jan 5, 2023

Will V4 support watching the dubbed versions of shows?

Yus by using dedicated flag or environment variable...

@umop3plsdn
Copy link

i just wanna say i'm in love with v4 have had no real hiccups to write about! the only thing i wish it had right now was the ability to fetch the dubs. but wanted to chime in and say absolutely love it and can't wait for actual release!

@Derisis13
Copy link
Collaborator

Derisis13 commented Jan 7, 2023

i just wanna say i'm in love with v4 have had no real hiccups to write about! the only thing i wish it had right now was the ability to fetch the dubs. but wanted to chime in and say absolutely love it and can't wait for actual release!

You already can by setting the environment variable ANI_CLI_MODE to dub (either with export ANI_CLI_MODE="dub" or with env ANI_CLI_MODE="dub" ani_cli)

@ircurry
Copy link

ircurry commented Jan 8, 2023

It works even better than V3 and I love the fzf interface. The only thing I miss is the ability to resume my place in the series but I know that is being worked on. Thank you for creating such an awesome script!

@archeite
Copy link
Contributor

archeite commented Jan 9, 2023

You already can by setting the environment variable ANI_CLI_MODE to dub (either with export ANI_CLI_MODE="dub" or with env ANI_CLI_MODE="dub" ani_cli)

Will there be any documentation on environment variables for ani-cli?

@Derisis13
Copy link
Collaborator

Also I forgot from the review that the manpage is not up-to-date, packagers are so gonna screw that one up (I don't even know what to do...)

well that's out of the way

Copy link
Contributor

@archeite archeite left a comment

Choose a reason for hiding this comment

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

There's some misspellings (Such as "Controll" having 2 ls), but everything so far looks good to me

ani-cli.1 Outdated Show resolved Hide resolved
ani-cli.1 Outdated Show resolved Hide resolved
ani-cli.1 Outdated Show resolved Hide resolved
@C0ff33W1thB4c0n
Copy link
Contributor

Could anyone change the vsersion on the PNG
.assets/ani-cli-spec.png & CONTRIBUTING.md#Architecture
It's still v3.4!

@justchokingaround
Copy link
Collaborator

justchokingaround commented Jan 23, 2023

yup, you're correct, nice catch, i'll fix it in 10 mins

(edit: fixed)

@port19x
Copy link
Collaborator Author

port19x commented Jan 23, 2023

Today I'll do:

  • thorough testing
  • thorough code review
  • another rebase
    (in that order)

The merge is getting closer

@port19x
Copy link
Collaborator Author

port19x commented Jan 23, 2023

I can now confirm that all features documented via -h work and do so as intended.

Only thing I can complain about is that we dropped -D for deleting history.
Unless there is a good rationale for that it should be implemented.

@justchokingaround
Copy link
Collaborator

-D for dmenu aka external menu (not implemented yet, but for future reference). but then we can just use smtg like --delete or --delete-history, that shouldn't be a problem

@port19x
Copy link
Collaborator Author

port19x commented Jan 23, 2023

-D for dmenu aka external menu (not implemented yet, but for future reference). but then we can just use smtg like --delete or --delete-history, that shouldn't be a problem

That is handled with the ANI_CLI_EXTERNAL_MENU env-var, so I see no point in reserving that.

We should think about how we document our advanced features that are accessible via env-vars only.
I'm unsure if they belong in regular -h

@justchokingaround
Copy link
Collaborator

it's documented in the man page
image

@port19x
Copy link
Collaborator Author

port19x commented Jan 23, 2023

it's documented in the man page image

Thats the perfect place for it 👍

README.md Outdated Show resolved Hide resolved
Note : Vlc Android now works too ;)
For players you can use the apk (playstore/fdroid) versions of mpv and vlc. Note that these cannot be checked from termux so a warning is generated when checking dependencies.

### Steam Deck
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I agree. Having all this in the main readme is a bit much.
<details> could also be a solution, so it's hidden by default but can be folded out.

search="${ANI_CLI_DEFAULT_SOURCE:-scrape}"

while [ $# -gt 0 ]; do
case "$1" in
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Or maybe that could be a fallback?
Not sure how you would handle that gracefully.
Currently the only option is to set it via envvar.

port19x and others added 9 commits January 23, 2023 15:36
Co-authored-by: port19 <port19@port19.xyz>
Co-authored-by: Derisis13 <email.felhasznalasra@gmail.com>
Co-authored-by: CoolnsX <ansari.tan20@gmail.com>
Co-authored-by: chokerman <44473782+justchokingaround@users.noreply.github.com>
Co-authored-by: zenith71 <71zenith@protonmail.com>
Co-authored-by: port19 <port19@port19.xyz>
Co-authored-by: Derisis13 <email.felhasznalasra@gmail.com>
Co-authored-by: CoolnsX <ansari.tan20@gmail.com>
Co-authored-by: chokerman <44473782+justchokingaround@users.noreply.github.com>
Co-authored-by: zenith71 <71zenith@protonmail.com>
Co-authored-by: port19 <port19@port19.xyz>
Co-authored-by: Derisis13 <email.felhasznalasra@gmail.com>
Co-authored-by: CoolnsX <ansari.tan20@gmail.com>
Co-authored-by: chokerman <44473782+justchokingaround@users.noreply.github.com>
Co-authored-by: zenith71 <71zenith@protonmail.com>
Co-authored-by: port19 <port19@port19.xyz>
Co-authored-by: Derisis13 <email.felhasznalasra@gmail.com>
Co-authored-by: CoolnsX <ansari.tan20@gmail.com>
Co-authored-by: chokerman <44473782+justchokingaround@users.noreply.github.com>
Co-authored-by: zenith71 <71zenith@protonmail.com>
Co-authored-by: port19 <port19@port19.xyz>
Co-authored-by: Derisis13 <email.felhasznalasra@gmail.com>
Co-authored-by: CoolnsX <ansari.tan20@gmail.com>
Co-authored-by: chokerman <44473782+justchokingaround@users.noreply.github.com>
Co-authored-by: zenith71 <71zenith@protonmail.com>
Co-authored-by: port19 <port19@port19.xyz>
Co-authored-by: Derisis13 <email.felhasznalasra@gmail.com>
Co-authored-by: CoolnsX <ansari.tan20@gmail.com>
Co-authored-by: chokerman <44473782+justchokingaround@users.noreply.github.com>
Co-authored-by: zenith71 <71zenith@protonmail.com>
Co-authored-by: port19 <port19@port19.xyz>
Co-authored-by: Derisis13 <email.felhasznalasra@gmail.com>
Co-authored-by: CoolnsX <ansari.tan20@gmail.com>
Co-authored-by: chokerman <44473782+justchokingaround@users.noreply.github.com>
Co-authored-by: zenith71 <71zenith@protonmail.com>
Co-authored-by: port19 <port19@port19.xyz>
Co-authored-by: Derisis13 <email.felhasznalasra@gmail.com>
Co-authored-by: CoolnsX <ansari.tan20@gmail.com>
Co-authored-by: chokerman <44473782+justchokingaround@users.noreply.github.com>
Co-authored-by: zenith71 <71zenith@protonmail.com>
+ docs: remove old deps and add syntax to code blocks
+ docs: acknowledging history disappearence
+ docs: missing fzf in brew installation
+ docs: windows instructions for v4
+ docs: termux instructions for v4

Co-authored-by: port19 <port19@port19.xyz>
Co-authored-by: Derisis13 <email.felhasznalasra@gmail.com>
Co-authored-by: CoolnsX <ansari.tan20@gmail.com>
Co-authored-by: chokerman <44473782+justchokingaround@users.noreply.github.com>
Co-authored-by: zenith71 <71zenith@protonmail.com>
@port19x
Copy link
Collaborator Author

port19x commented Jan 23, 2023

Rebase done.
This time without any merge conflicts, so no regressions.
Remember to pull with --rebase

@Derisis13
Copy link
Collaborator

Can we merge now?

Copy link
Contributor

@archeite archeite left a comment

Choose a reason for hiding this comment

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

Forgot to create additional comments for other misspellings

ani-cli.1 Outdated Show resolved Hide resolved
ani-cli.1 Outdated Show resolved Hide resolved
ani-cli.1 Outdated Show resolved Hide resolved
ani-cli.1 Outdated Show resolved Hide resolved
ani-cli.1 Outdated Show resolved Hide resolved
ani-cli.1 Outdated Show resolved Hide resolved
ani-cli.1 Outdated Show resolved Hide resolved
ani-cli.1 Outdated Show resolved Hide resolved
Derisis13 and others added 3 commits January 24, 2023 08:50
+ docs: remove v3.4 stuff
+ docs: dmenu -> rofi dmenu (dmenu doesn't support multi)
+ docs: remove "new in v4"

Co-authored-by: archeite <121004047+archeite@users.noreply.github.com>
Co-authored-by: port19 <port19@port19.xyz>
Co-authored-by: Derisis13 <email.felhasznalasra@gmail.com>
Co-authored-by: CoolnsX <ansari.tan20@gmail.com>
Co-authored-by: chokerman <44473782+justchokingaround@users.noreply.github.com>
Co-authored-by: zenith71 <71zenith@protonmail.com>
Co-authored-by: port19 <port19@port19.xyz>
Co-authored-by: Derisis13 <email.felhasznalasra@gmail.com>
Co-authored-by: CoolnsX <ansari.tan20@gmail.com>
Co-authored-by: chokerman <44473782+justchokingaround@users.noreply.github.com>
Co-authored-by: zenith71 <71zenith@protonmail.com>
The version variable inside the script should always be major.minor.patch
major.minor releases are reserved for native packages and tags/releases

Co-authored-by: port19 <port19@port19.xyz>
Co-authored-by: Derisis13 <email.felhasznalasra@gmail.com>
Co-authored-by: CoolnsX <ansari.tan20@gmail.com>
Co-authored-by: chokerman <44473782+justchokingaround@users.noreply.github.com>
Co-authored-by: zenith71 <71zenith@protonmail.com>
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.

Animixplay EOL / Episode not released yet