pystardust / ani-cli

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

added the '--save-position-on-quit' to continue from where the user h… #1154

Closed c2700 closed 1 year ago

c2700 commented 1 year ago

…ad left off on said episode

Pull Request Template

Type of change

Description

ramble here

Checklist

Additional Testcases

justchokingaround commented 1 year ago

mpv has a keybind by default to do this, you can press shift+q instead of just q to quit. you can also set the option to save on quit by default in your mpv.conf

c2700 commented 1 year ago

mpv has a keybind by default to do this, you can press shift+q instead of just q to quit. you can also set the option to save on quit by default in your mpv.conf

Learned something new today, thank you :)

c2700 commented 1 year ago

If only it was this easy. But the different providers' links are treated as separate media, so if you get a different one the next time, it won't work. And the links don't live forever, which means that once they expire it'll be a separate media, won't work as intended.

Also there's the ambiguity of whether you just want to skip the end credits or you couldn't finish the episode in your lunch break.

All of this can be probably resolved, but it needs some thinking

My bad. I opened this PR cuz it worked for me as intended on all the episodes that I have been watching & have watched (episode continues from where I hit 'q'). And skipping the outro & intro was something that didn't cross my mind. As for skipping the outro & intro is it possible for sponsorblock to be used here? Sure the sponsorblock database may need to be updated every now & then but to reduce the work all the info of all available intros & outros could be scraped from vimeo, youtube, dailymotion or any video platform & that could be put into the sponsorblock's database which will be applied to all the episodes that have the same intro & outro. This is just one way I could come up with skipping segements cuz I did see mpv being shown as a 3rd party port in the sponsorblock's site (I used to use youtube vanced). This is just a suggestion. I'm unaware of how tedious it can get though

justchokingaround commented 1 year ago

@c2700

c2700 commented 1 year ago

Sorry if I'm being really stupid here but, if that's kind of like bloat (The position tracking implemented in the lobster repo that you pointed me to) in ani-cli's case, I was thinking to implement only the parts that keep track of the position while also checking if the tracked position is the same as the position of the end of the video.

if the tracked position isn't the same as the end of the video then append it to the line where the anime name exists where it's separated by " | " which would look something like this "[episode] [anime_name] | [position]".

It's the same format as what's currently in the history file but with an append operation.

& when using ani-cli's "-c" option make mpv use the "--start=" options where it's value "[postion]" is pulled from the history file.

& until the "next" option from ani-cli is selected or the video reaches the end the only string that will be overwritten in the history file will be the " | [position]".

Will this method require rewriting the history implementation though?

justchokingaround commented 1 year ago

this part would require a rewrite: https://github.com/pystardust/ani-cli/blob/master/ani-cli#L220-L234, this part too: https://github.com/pystardust/ani-cli/blob/master/ani-cli#L398-L412, the play function would require many additional checks, and it would add many lines of code, especially since there is a need for an implementation with socat and without it, since it would be an optional dependency

c2700 commented 1 year ago

okay, now that you've pointed me over there I can KINDA see how much of a change it will need. mind if I implement those changes? (As long as the position tracker alone isn't bloat in ani-cli's case i.e.) + socat in this case would make it a necessary dependency rather than an optional one right?

justchokingaround commented 1 year ago

you can implement it if ubwish, but it's unlikely that we will merge it into ani-cli. socat must be an optional dependency, because it doesn't exist on windows, so u must also have coverage for the case where u just play videos, without using socat and saving position

c2700 commented 1 year ago

okay, will be implementing the necessary changes then

justchokingaround commented 1 year ago

what?

c2700 commented 1 year ago

As in, I'll be making the changes necessary to implement the "start from where I left off" if you're okay with it

justchokingaround commented 1 year ago

sure, u can hmu if u got any questions or need help. i'm personally in favor of this feature, but i dont think thats the case for all maintainers

c2700 commented 1 year ago

sure, will do :)