jonniek / mpv-playlistmanager

Mpv lua script to create and manage playlists
The Unlicense
537 stars 42 forks source link

Set position "selected_file" to the currently playing title after opening or through hotkey #111

Closed dnngll closed 1 year ago

dnngll commented 1 year ago

Hello,

when opening the playlist, the selected item is always the first item in the list. It would be great to have an option that would

and/or

Does anyone else think that would make sense?

Thanks

jonniek commented 1 year ago

when opening the playlist, the selected item is always the first item in the list

This should not be the case if you use reset_cursor_on_close=yes. Can you show an example?

have a dynamic bind that jumps to the currently playing file in the list after pressing the defined key

This can be achieved by closing and reopening the playlist when using reset_cursor_on_close=yes. I could add a bind for this if closing and reopening is not ergonomic.

dnngll commented 1 year ago

Hello @jonniek ,

thank you for your patience. I just got back from a vacation yesterday, hence the late reply.

To my second point: A dynamic bind is not necessary, if opening the playlist does highlight the current file. I totally agree. The reason I brought it up was, that I initially thought, opening the playlist would not do that (because it didn't). And that leads me to the real issue: There's a bug somewhere:

I realized that the behavior is sometimes as desired (opening playlist | currently played file is selected and centers), and sometimes it is not (first/other item on list is highlighted). I tried narrowing it down to path- or filename, but couldn't. The results are not reproduceable. Here's an example:

This is my folder structure:

image

I opened the 7th file (qqoumabj - S01E04 (2012) - jskvxbpg.mkv) several times in a row, and got different results. Here are 3 screenshots just after opening the file:

2023 01 11, 10 27 26

2023 01 11, 10 28 19

2023 01 11, 10 29 14

In case you want to reproduce, these are the file-names:

M:\test CANDEL\dede dedede dedede\de dddddddddd

bifpbsup - S01E11 (2012) - irdpyjvn.mkv
ggroqpyx - S01E01 (2012) - tdvstwmd.mkv
gicxyrua - S01E03 (2012) - apmclrfl.mkv
gwlhknqy - S01E09 (2012) - etrqcpta.mkv
icqiqrxd - S01E07 (2012) - vjsthqcs.mkv
pdxxevhu - S01E05 (2012) - ekgrfbqj.mkv
qqoumabj - S01E04 (2012) - jskvxbpg.mkv
rqgeayxy - S01E10 (2012) - nvkaiagv.mkv
thhtewmf - S01E06 (2012) - ysixallx.mkv
wocntqsp - S01E02 (2012) - idfjtgcp.mkv
xhgdiamt - S01E08 (2012) - fyxpccrc.mkv

If you need any more information please don't hesitate to contact me.

Thanks

FichteFoll commented 1 year ago

I've also noticed this behavior recently but I wasn't sure how to reliably reproduce it. I was using it on a playlist with ~300 URLs (that now also have EXTINF titles set so playlistmanager doesn't try to query for them every time) and that I had the last position saved by quitting with Q, but when I open the playlistmanager interface, I quite frequently am not looking at the currently playing entry but rather some other place, seemingly what I was at the last time the view was opened, which would be the start of the playlist when first opening it. Simply closing and then reopening the playlist usually fixes the behavior.

dnngll commented 1 year ago

Hello @FichteFoll ,

I can confirm your last point, tried it. Plus I found another way to fix the behavior. So now there's two:

Tried both 10 times, 100% reproduceable

jonniek commented 1 year ago

I opened the 7th file (qqoumabj - S01E04 (2012) - jskvxbpg.mkv) several times in a row

What script are you using for loading the rest of the files to the playlist? There could be some problem like that script running sometimes after the file-loaded event.

There has been some changes recently in the file-loaded and file-started events that could fix some race conditions like this.

Anyway I added a setting to reset cursor when opening the playlist which should fix this issue regardless of what the root cause is/was.

dnngll commented 1 year ago

Hey @jonniek ,

I am using https://github.com/mpv-player/mpv/blob/master/TOOLS/lua/autoload.lua for that... Not the current version though, I got the scrip a few weeks back.

Before updating autoload, I will try your new version, and report back to you here.

Thanks

dnngll commented 1 year ago

Hello @jonniek ,

I used the updated version, and again tried 10 times: It worked as expected every time!

Thank you so much!