Eisa01 / mpv-scripts

This repository contain scripts I have made for mpv media player...
BSD 2-Clause "Simplified" License
557 stars 37 forks source link

How do I bookmark .m3u playlist? #77

Closed BhaturaGuy closed 1 year ago

BhaturaGuy commented 1 year ago

I want to bookmark .m3u playlist, the current playing file and position in that playlist. But it bookmarks only the playing file and the file next to it. NOT the playlist. also it appends the files in that directory.

Lets say I am playing a .m3u playlist and I want to bookmark the PLAYLIST, and the current playing file and position of that playlist. Without it automatically adding other files in that directory. And If I bookmark a video file lets say abc.mkv then when I load that it shouldnt autoload other files in that directory. Is it possible?

Eisa01 commented 1 year ago

Since I never used playlist, I did not write the code to handle it. Current code is unable to treat the playlist file as its own thing, so it detects the playing file. There are couple of problems with treating playlists separately, but I need to test it out because it's a new thing for me.

I will update you if I am able to treat playlists appropriately and not the playing file.

Eisa01 commented 1 year ago

There is a limitation from mpv. It doesn't identify the playlist file, only the playing file.

I'll look for a workaround but no promises.

Eisa01 commented 1 year ago

Opened an issue in mpv main repository, wil see how it goes: https://github.com/mpv-player/mpv/issues/11269

Eisa01 commented 1 year ago

Closed since this is not possible per mpv team.

Eisa01 commented 1 year ago

Re-opened since it should be possible based on latest comment from mpv team.

BhaturaGuy commented 1 year ago

Re-opened since it should be possible based on latest comment from mpv team.

That's great. Also an option to NOT autoload files in directory of bookmarked file/playlist?

Eisa01 commented 1 year ago

I have a workaround that in theory should make this possible. It is still yet to be tested, but I'll attempt to write the code and will let you know when it is ready for testing.

However, autoload should not work only if the file was loaded using a playlist am I correct?

BhaturaGuy commented 1 year ago

autoload should not work only if the file was loaded using a playlist am I correct?

Not exactly, it's like if there are 3 files in a directory: 1.mkv, 2.m3u(listing n number of files in same or different directory), 3.mkv.

If I bookmarked .m3u playlist then when I load it using bookmark menu then it should only load those n files, not 1.mkv and 3.mkv with it.

Same function if I bookmark 1.mkv then when I load it using bookmark menu it should only load 1.mkv then when it is finished mpv should return to idle state.

Should be optional since I don't think majority of the users might want this to be permanent or default

Eisa01 commented 1 year ago

Same function if I bookmark 1.mkv then when I load it using bookmark menu it should only load 1.mkv then when it is finished mpv should return to idle state.

I don't think this should be done, and it might not be possible. autoload script is populating the playlist based on its rules. (Basically you are requesting different end-file behavior for items opened through bookmark list) however, this is another scenario from bookmarking playlists. Open a separate issue, then i will study the use-case for it.

Eisa01 commented 1 year ago

Ah, after simi-implementation. Handling playlists will cause problems. In short... it is not worth the trouble.

Below attempt logs the playlist, but still doesn't functionally load it as I decided to close this issue. SimpleBookmark.txt

Further clarification: The reason is due to how mpv handles nested playlists. The expansion happens after a nested playlist is selected, causing the playlist-count and playlist-playing-pos to not be accurate. Both properties won't represent the initial state when opening a playlist, which will result in any logging attempt that handles a nested playlist to be inaccurate.