ripose-jp / Memento

An mpv-based video player for studying Japanese
https://ripose-jp.github.io/Memento/
GNU General Public License v2.0
490 stars 21 forks source link

Keep session and autoplay last played video #148

Closed Issue-maker-9000 closed 1 year ago

Issue-maker-9000 commented 1 year ago

I use the autoload script to so all episodes of an anime get added to the playlist automatically, if possible I would like it to remember the playlist when exiting memento and resume where I left off when starting memento.

There are scripts for this but all of them seem to have the same problem of opening in a separate mpv window instead of playing in the memento window.

ripose-jp commented 1 year ago

the autoload script

I don't know what script you're talking about. Please link it.

I would like it to remember the playlist when exiting memento and resume where I left off when starting memento.

How is this different from mpv's built in watch later functionality? I don't really use playlists, so I wouldn't know what your workflow is, but from my understanding your position in a playlist is saved.

There are scripts for this but all of them seem to have the same problem of opening in a separate mpv window instead of playing in the memento window.

I've only seen this happen when the vo is set to something other than libmpv. I'm not saying this is the only reason this can happen, but it's the only reason I've seen so far. It would be strange for such a script to set the vo when loading a file though, so I really do want to see what script you're using.

Issue-maker-9000 commented 1 year ago

I don't know what script you're talking about. Please link it.

Autoload "-- This script automatically loads playlist entries before and after -- the currently played file. It does so by scanning the directory a file is -- located in when starting playback. It sorts the directory entries -- alphabetically, and adds entries before and after the current file to -- the internal playlist. "

How is this different from mpv's built in watch later functionality? I don't really use playlists, so I wouldn't know what your workflow is, but from my understanding your position in a playlist is saved.

I also use the watch later functionality, but it only saves the playback position. You still have to navigate to the video manually to resume where you left off. Even a list of last played videos would suffice, sadly scripts that add this functionality aren't accessible when memento is idle. (This differs from standard mpv where you can access historylists when the player is idle)

I've only seen this happen when the vo is set to something other than libmpv. I'm not saying this is the only reason this can happen, but it's the only reason I've seen so far. It would be strange for such a script to set the vo when loading a file though, so I really do want to see what script you're using.

The SimpleHistory script with "startup_idle_behavior" set to "resume" is what I am kinda looking for, but like I said a easy way to resume playback of the last played video is also something I would be happy with.

I've set vo to libmpv manually but same result as in the image, where the video plays in a separate window while the subtitles stay in memento.

memento

ripose-jp commented 1 year ago

I can reproduce the behavior you're getting with SimpleHistory. I'll see if there's some way I can fix it and get back to you. Ideally, I'll be able to fix it within Memento or upstream so I don't have to maintain this feature myself.

ripose-jp commented 1 year ago

You found a super interesting bug. Turns out SimpleHistory was observing the idle-active property. By default libmpv has idle=yes because otherwise the core would immediately exit. Since Memento initializes the mpv context before the mpv render context, the idle-active observer in SimpleHistory would trigger before mpv knew that the vo should be libmpv. This would lead to mpv assuming vo=gpu and opening a new window. The bug can be fixed by initializing the mpv context after the mpv render context.

I'll get a fix up shortly.

Issue-maker-9000 commented 1 year ago

Interesting. thanks so much for looking into it! Just built master, all seems to work as expected. For some reason no icons showing up in my build but that is not that big of a deal. :P

ripose-jp commented 1 year ago

Turns out the Windows build script was broken by a name change of a runtime dependency. Due to some misconfiguration the Windows build pipeline missed it. This lead to QtWinDeploy not copying QtSVG (I think), leading to the missing icons. I got a fix up on dev and I'll merge it to master when CI finishes.

Thanks for finding two actionable issues.