ani-cli icon indicating copy to clipboard operation
ani-cli copied to clipboard

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

Open dev-r34per opened this issue 5 years ago • 16 comments

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.

dev-r34per avatar Nov 02 '21 19:11 dev-r34per

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

pystardust avatar Nov 05 '21 18:11 pystardust

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.

dev-r34per avatar Nov 05 '21 21:11 dev-r34per

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.

ghost avatar Nov 06 '21 17:11 ghost

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 avatar Dec 29 '21 13:12 port19x

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

port19x avatar Dec 31 '21 14:12 port19x

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.

galloway avatar Jan 14 '22 21:01 galloway

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

port19x avatar Jan 20 '22 14:01 port19x

@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.

dev-r34per avatar Jan 20 '22 15:01 dev-r34per

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

RaynardGerraldo avatar Jan 21 '22 13:01 RaynardGerraldo

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

dev-r34per avatar Jan 21 '22 14:01 dev-r34per

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.

RaynardGerraldo avatar Jan 21 '22 15:01 RaynardGerraldo

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

BAaboe avatar Jan 24 '22 08:01 BAaboe

Why not make it default behaviour?

port19x avatar Jan 24 '22 08:01 port19x

Why not make it default behaviour?

I can do that

BAaboe avatar Jan 24 '22 10:01 BAaboe

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

port19x avatar Jan 24 '22 10:01 port19x

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

BAaboe avatar Jan 24 '22 11:01 BAaboe