Skip to content

demux_libarchive: support --autocreate-playlist#17956

Open
guidocella wants to merge 2 commits into
mpv-player:masterfrom
guidocella:archive-autocreate
Open

demux_libarchive: support --autocreate-playlist#17956
guidocella wants to merge 2 commits into
mpv-player:masterfrom
guidocella:archive-autocreate

Conversation

@guidocella
Copy link
Copy Markdown
Contributor

Useful for selecting archive URLs from the watch later menu.

Useful for selecting archive URLs from the watch later menu.
@kasper93
Copy link
Copy Markdown
Member

I don't know why you wound need that. Opening archives is slow and as I understand you will no always open/list whole archive instead of just accessing a single file from it. I don't think it belongs in the same option or at all.

With --autocreate-playlist archive:// URLs become the playlist-path, so
mpv writes redirect entries for these playlist-paths which make playback
resume from them instead of later files in the archive.

Avoid writing redirect entries for archive:// URLs to fix this.
@guidocella guidocella force-pushed the archive-autocreate branch from a561f73 to a2a5a11 Compare May 26, 2026 19:43
@po5
Copy link
Copy Markdown
Contributor

po5 commented Jun 1, 2026

I think this is a good addition. Users want this feature, see https://github.com/AndreiVernon/mpv-autoload-archives
I'm not so sure about the implementation, since simple string comparison isn't enough when we use custom mpv protocols:
slice://0@archive://slice://0@archive://slice://0@./cool.zip%7C/beans.zip|/aaa/worst-case-scenario.mp4
The solution I use is to resolve the each protocol, and keeping track of what the innermost archive is. It can't be regexed, each protocol has to be parsed.
I'm not familiar enough with mpv's internals, but since you're checking within demux_libarchive whether the path starts with archive:// or not, I assume the path hasn't already been parsed/reduced down to only the archive:// part before it reaches this code? If it is pre-parsed, I'm not sure why the check is necessary.

About the "watch later" files, these are the protocols that load data from memory or from the command line, that in my opinion should not be logged: https://github.com/po5/memo/blob/e0624611438b2e19ef4b7e24f53461c9d0304b07/memo.lua#L160-L169

@guidocella
Copy link
Copy Markdown
Contributor Author

I don't know if that's feasible to support from demux_libarchive. It checks for URLs because it needs to run only when the path is an archive:// URL rather than foo.zip.

As my comment says the watch later condition was only meant for archive files. But it turned out to be also needed for #16530, to make youtube playlists work it needs to save watch later files for http playlist paths. So we can just limit it to non-URLs and http URLs.

Another issue I have no solution for is that when resuming playback from archive:// URLs the watch for later file for foo.zip is never deleted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants