pystardust / ani-cli

A cli tool to browse and play anime
GNU General Public License v3.0
7.7k stars 538 forks source link

[Feature Request] Jump to next episode with builtin mpv command #102

Closed uestueab closed 2 years ago

uestueab commented 2 years ago

When i specify a range for the episodes i want to watch, the program opens n instances of mpv for each episode within the range. Would it not be more natural to queue those episodes instead like a playlist? That means when the credits roll, i can just issue my mpv command to jump to the next item in the list and never be interrupted.

pystardust commented 2 years ago

As far as I know to queue stuff up in mpv you need to provide all the urls to it in the start. But getting the urls takes time (scraping the page). So the sacrifice to this would be to have a very big delay before even the first episode plays

uestueab commented 2 years ago

The delay of course depends on the number of items to be fetched, though i really feel like this a key feature so i would accept the sacrifice.

Lukasz825700516 commented 2 years ago

Url history/cache file for seasons could be generated/updated by additional flag option, for storing scraped episodes urls. That would make scrapping lag only once at the fist search of series, but as downside changing quality would require populating such file again.

port19x commented 2 years ago

This would be useful for bingewatching. If you want to start work on an implementation, feel free to do so. Otherwise this might stay open for a while

port19x commented 2 years ago

As far as I know to queue stuff up in mpv you need to provide all the urls to it in the start. But getting the urls takes time (scraping the page). So the sacrifice to this would be to have a very big delay before even the first episode plays

Yes

The delay of course depends on the number of items to be fetched, though i really feel like this a key feature so i would accept the sacrifice.

Since that delay would only appear if you specify a range of episodes, this doesn't affect users that watch one episode at a time. The benefit would far outweigh the cost for users watching multiple episodes at once

Url history/cache file for seasons could be generated/updated by additional flag option, for storing scraped episodes urls. That would make scrapping lag only once at the fist search of series, but as downside changing quality would require populating such file again.

This is a bad idea, assuming video locations are changed on a regular basis by gogoanime, otherwise it would be a good candidate for a cache file

galloway commented 2 years ago

It looks like the umpv (python) script provides an enqueuing functionality to mpv that might provide some hints on how this could be done.

This batch file seems to provide similar functionality for windows users.

And vlc has the --one-instance and --playlist-enqueue options from the cli.

It's all a bit beyond me, but maybe this can point someone more experienced in the right direction.

port19x commented 2 years ago

mpv playlist files are just plaintext files with one filepath (or in our case url) per line. We can use mktemp to safely generate a temporary file and then write the selected episode range to that tempfile. After that we invoke mpv on the tempfile

uestueab commented 2 years ago

@ura43 That's right. Without this feature it would mean to go back to ani-cli and select the next episode. Well at that point there is almost no point in using this script at all, since i can use Firefox's picture-in-picture mode and make use of the browsers mpris interface to control the video.

RaynardGerraldo commented 2 years ago

do we really need this feature? I mean if you really want to binge then just use

Multiple episodes can be chosen given a range Choose episode [1-13]: 1 6 This would choose episodes 1 2 3 4 5 6

as stated in help

uestueab commented 2 years ago

You still have to go back to ani-cli for each next episode. Why would you interrupt the users workflow? Its bad by design. Currently there is only little incentive for anyone to use ani-cli, when using firefox/picture-in-picture/mpris is the more viable alternative. The only thing, which is in favor of your project is that it tracks the watch history.

Though, being able to go to the next episode, globally from any workspace, no matter in which window i am, that would be valuable indeed.

Video below: Demo controlling a picture-in-picture video using playerctl.

https://user-images.githubusercontent.com/16192241/150544061-14f21385-69fd-438a-bd3d-3446e7cb3d15.mp4

RaynardGerraldo commented 2 years ago

You still have to go back to ani-cli for each next episode. Why would you interrupt the users workflow? Its bad by design. Currently there is only little incentive for anyone to use ani-cli, when using firefox/picture-in-picture/mpris is the more viable alternative. The only thing, which is in favor of your project is that it tracks the watch history.

Though, being able to go to the next episode, globally from any workspace, no matter in which window i am, that would be valuable indeed.

Video below: Demo controlling a picture-in-picture video using playerctl.

firefox_mpris.mp4

You know the "going back to ani-cli for each next episode" is just to load the next episode right? As in after the user picks episode range they dont have to do anything ,everytime an episode ends its gonna close mpv and reopen it with the next episode just like that.

Heck if the users previous window wasnt the terminal it wouldnt even show ani-cli prompts,it would just show mpv being closed and reopened with the next episode.

Edit: dont want to wait till the end credits? Just close the mpv window and poof new mpv window with the next episode playing

Im not saying its not a good feature to have,but it would take some tinkering to figure it out. And right now we do have something that is similar to this feature. But again feel free if you want to try and implement this.

BAaboe commented 2 years ago

I am working on a fork that does this, instead of loading all the episodes at the start it loads them after every episode. I already got a working version of this. https://github.com/BAaboe/ani-cli

Btw: you have to use -A to make it work

port19x commented 2 years ago

Why not make it default behaviour?

BAaboe commented 2 years ago

Why not make it default behaviour?

I can do that

port19x commented 2 years ago

I mean it doesn't break current behaviour if you just provide a single episode number, right? If that assumption holds true I think that would be the way to go

BAaboe commented 2 years ago

i think it works now. when you specify a range it will auto play all the episodes in that range, if you only specify one episode it will just be normal ani-cli