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: added support for ani-skip to skip episode intros #1231

Merged
merged 17 commits into from
Nov 30, 2023

Conversation

azureorangexyz
Copy link
Contributor

Pull Request

Type of change

  • Bug fix
  • Feature
  • Documentation update

Description

I saw the issue #1223 and sympathized with the idea of skipping intros.
So implemented the skipping function into ani-cli (it still needs ani-skip to be installed though.)

Skipping does not work for all anime I've tested, but does for some.
If ani-skip fails, ani-cli just prints a message stating, that it failed and proceeds as normal.

Also it only works with mpv (due to how ani-skip works) and this is noted in the help function as well as the man page.

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
  • --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)

@azureorangexyz azureorangexyz changed the title feature: added support for ani-skip to skip episode intros feat: added support for ani-skip to skip episode intros Oct 27, 2023
Copy link
Collaborator

@Derisis13 Derisis13 left a comment

Choose a reason for hiding this comment

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

You did a nice job implementing the feature in a way that's consistent to the other parts of the script. There's just one thing missing: ani-skip install instructions in the readme. There should be a reference to their instructions with some description on what it does

ani-cli Outdated Show resolved Hide resolved
ani-cli Outdated Show resolved Hide resolved
@port19x port19x linked an issue Oct 28, 2023 that may be closed by this pull request
Copy link
Collaborator

@port19x port19x left a comment

Choose a reason for hiding this comment

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

Very nice implementation.
I have nothing to add to the review by @Derisis13

@synacktraa
Copy link

synacktraa commented Oct 28, 2023

You did a nice job implementing the feature in a way that's consistent to the other parts of the script. There's just one thing missing: ani-skip install instructions in the readme. There should be a reference to their instructions with some description on what it does

Hi, I am opening a pull request to include the ani-skip directly into ani-cli. There's no need to include ani-skip as a dependency.

It would be nice, If this PR is merged first. I'll only have to replace the function.

@synacktraa
Copy link

synacktraa commented Oct 28, 2023

I've also wrote a lua script for vlc player. VLC is not as flexible as MPV, We'll need to find a suitable way to pass in options or hard-code them.

@lasersPew
Copy link

Before you accept this pr, it would be better if you add ani-skip onto the features and the dependency requirements. Additionally, warn windows users as I get ani-skip not installed and there's no official app for it.

@synacktraa
Copy link

Before you accept this pr, it would be better if you add ani-skip onto the features and the dependency requirements. Additionally, warn windows users as I get ani-skip not installed and there's no official app for it.

I'll include the code directly into ani-cli script, you won't have to install ani-skip explicitly

@Derisis13
Copy link
Collaborator

Hi, I am opening a pull request to include the ani-skip directly into ani-cli. There's no need to include ani-skip as a dependency.

It would be nice, If this PR is merged first. I'll only have to replace the function.

I'm against including lines of code instead of an available solution: just as we outsourced our ui to fzf and rofi, I see no point in re-implementing ani-skip. The reason is we have to maintain our code, but dependencies take care of themselves.

This PR looks fine as is.

@Derisis13
Copy link
Collaborator

I've also wrote a lua script for vlc player. VLC is not as flexible as MPV, We'll need to find a suitable way to pass in options or hard-code them.

This is welcome once the PR is merged

@azureorangexyz
Copy link
Contributor Author

azureorangexyz commented Oct 28, 2023

Sorry about the thousend commits on the readme, it's definitely to late to work now ... haha.
Is there a script or something to do all the checks before commiting them?

You did a nice job implementing the feature in a way that's consistent to the other parts of the script. There's just one thing missing: ani-skip install instructions in the readme. There should be a reference to their instructions with some description on what it does

I did update the README as well, I've put everything under the dependencies section (should be fine I guess).

Before you accept this pr, it would be better if you add ani-skip onto the features and the dependency requirements. Additionally, warn windows users as I get ani-skip not installed and there's no official app for it.

I added a warning to the ani-skip description. I should work under Android and MacOS right? (Not shure about iOS though.)

@port19x
Copy link
Collaborator

port19x commented Oct 28, 2023

I can test mac compatibility tomorrow, code and readme looks good.
I'm also against inclusion of ani-skip code in mainline, unless the expansion over the currently proposed solution would be negligible.
Either way I'm in favour of merging early and making concessions to windows users later.

@Derisis13
Copy link
Collaborator

I'm also against inclusion of ani-skip code in mainline, unless the expansion over the currently proposed solution would be negligible

it's 27 lines of shell scripting and another 27 lines of lua. Since we can't include the lua scrip anyway I'd leave ani-skip in the hands of its current maintainer.

@synacktraa
Copy link

I'm also against inclusion of ani-skip code in mainline, unless the expansion over the currently proposed solution would be negligible

it's 27 lines of shell scripting and another 27 lines of lua. Since we can't include the lua scrip anyway I'd leave ani-skip in the hands of its current maintainer.

Yes, lua scripts are another issue.

@71zenith
Copy link
Collaborator

Pls add the copying of ani-skip shell script to $PATH in the readme install instructions

@71zenith
Copy link
Collaborator

@synacktraa also pls implement skipping for outro as well

@71zenith
Copy link
Collaborator

modify the script to redirect stderr if the script cannot find the anime
image
dont rely on a edge case

@71zenith
Copy link
Collaborator

image
did none of u check if this runs, modify ani-cli or ani-skip to discard the (n episodes)
MAL is already extremely picky and does not have the best search engine, it will never give the right results if we add unnecessary metadata to the query

@synacktraa
Copy link

modify the script to redirect stderr if the script cannot find the anime

image

dont rely on a edge case

Isn't die function already redirecting it to stderr?

@synacktraa
Copy link

image

did none of u check if this runs, modify ani-cli or ani-skip to discard the (n episodes)

MAL is already extremely picky and does not have the best search engine, it will never give the right results if we add unnecessary metadata to the query

I haven't tested ani-skip with ani-cli yet, been just resolving ani-skip issues

@71zenith
Copy link
Collaborator

71zenith commented Oct 31, 2023

my bad, it looks like it does discard the (n episodes) however it seems that u try to match the exact title name in the mal results. this however will more than likely not work for anime with >1 seasons and those which are named differently in allanime

@synacktraa
Copy link

image

did none of u check if this runs, modify ani-cli or ani-skip to discard the (n episodes)

MAL is already extremely picky and does not have the best search engine, it will never give the right results if we add unnecessary metadata to the query

I haven't tested ani-skip with ani-cli yet, been just resolving ani-skip issues

Tell me if you're modifying ani-cli, else I'll do something with ani-skip

@synacktraa
Copy link

Someone will have to first take me through ani-cli code, especially the episode range parsing thing.

ani-cli Outdated
@@ -1,6 +1,6 @@
#!/bin/sh

version_number="4.6.2"
version_number="4.7"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
version_number="4.7"
version_number="4.7.0"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sorry, my bad, is done.

Copy link
Collaborator

@port19x port19x left a comment

Choose a reason for hiding this comment

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

3 digit version number please

@synacktraa
Copy link

synacktraa commented Oct 31, 2023

@synacktraa also pls implement skipping for outro as well

Here you go. synacktraa/ani-skip@657a1de @71zenith

@port19x
Copy link
Collaborator

port19x commented Nov 6, 2023

I plan to merge and release sometime later today

@port19x port19x requested a review from Derisis13 November 6, 2023 17:13
@port19x
Copy link
Collaborator

port19x commented Nov 6, 2023

Looks good and works on my end

Needs sign off from @Derisis13 due to requested changes

Copy link
Collaborator

@Derisis13 Derisis13 left a comment

Choose a reason for hiding this comment

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

Code is good, readme is a bit too verbose. Sorry for going back and forth on this, my goal is not to need to update the readme if ani-skip changes their installation method (eg. gets packed as an aur package) and to be in line with the current readme. The way it is now sticks out like a sore thumb

Code is still good, tested and works.

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
@lasersPew
Copy link

Imma test some stuff with windows and WSL.

@synacktraa
Copy link

Imma test some stuff with windows and WSL.

ani-skip is working in Wsl
Try gitbash too if possible

@manorit2001
Copy link

I am on Manjaro, not sure if that affects but getting the following output for ani-skip and one piece, am I doing something wrong? I tried the same with this PR as well but didn't see any skip so tried to do this.

ani-skip "1P (1084 episodes)" 341
--script-opts= '--script=/home/user/.config/mpv/scripts/skip.lua'

@synacktraa
Copy link

synacktraa commented Nov 9, 2023

I am on Manjaro, not sure if that affects but getting the following output for ani-skip and one piece, am I doing something wrong? I tried the same with this PR as well but didn't see any skip so tried to do this.


ani-skip "1P (1084 episodes)" 341

--script-opts= '--script=/home/user/.config/mpv/scripts/skip.lua'

image

update ani-skip once. sudo ani-skip -U

@lasersPew
Copy link

I am on Manjaro, not sure if that affects but getting the following output for ani-skip and one piece, am I doing something wrong? I tried the same with this PR as well but didn't see any skip so tried to do this.


ani-skip "1P (1084 episodes)" 341

--script-opts= '--script=/home/user/.config/mpv/scripts/skip.lua'

image

update ani-skip once. sudo ani-skip -U

This actually doesn't solve the problem. tried using One Piece instead of 1P (1084 episodes) and got the script opts:
image

@port19x port19x requested a review from Derisis13 November 15, 2023 10:12
@71zenith
Copy link
Collaborator

works nicely (would have preferred to run it in background)
about the one piece thing. im afraid there is so much we can do about it. they likely do it to not get noticed by the big corp daddies.

@synacktraa
Copy link

This actually doesn't solve the problem. tried using One Piece instead of 1P (1084 episodes) and got the script opts: image

If there was no error, it means there was an entry related to 1P, it's just that parsing is not working well. I'll do something about it. If it was python, we could have used vectors or ngrams to get most relevant entry.

Copy link
Collaborator

@Derisis13 Derisis13 left a comment

Choose a reason for hiding this comment

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

Totally didn't just forgot this

@port19x port19x merged commit 4a77bca into pystardust:master Nov 30, 2023
PhosCity pushed a commit to PhosCity/ani-cli that referenced this pull request Dec 7, 2023
@NKTMQ
Copy link

NKTMQ commented Feb 12, 2024

Imma test some stuff with windows and WSL.

ani-skip is working in Wsl Try gitbash too if possible

For any windows users that setup ani-cli with scoop, the likely best way is to use scoop to create a shim for ani-skip as well.

step 1
scoop install { "version": "1.0", "url": "https://raw.githubusercontent.com/synacktraa/ani-skip/master/ani-skip", "bin": "ani-skip" }

step 2
Place https://raw.githubusercontent.com/synacktraa/ani-skip/master/skip.lua
Into the mpv scripts folder.

Scripts folder autoruns any lua files in it so we can ignore the "--script=$HOME/.config/mpv/scripts/skip.lua" component of the ani-skip output as mpv will ignore it (with an error message saying file not found).

Otherwise if you'd like to have the script elsewhere you can edit the ani-skip's 4th line from the scoop install to be a windows folder path instead.

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.

Ani-skip
10 participants