Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: use loadlist when opening playlists #929

Merged
merged 1 commit into from
Jul 9, 2024

Conversation

christoph-heinrich
Copy link
Contributor

@christoph-heinrich christoph-heinrich commented Jul 8, 2024

Opening a playlist with loadfile can lead to problems like autoload.lua populating the playlist with other files that were in the same directory as the playlist file.

To avoid that the command loadlist can be used to avoid having mpv treat the file like any other, just to notice during demuxing that it is a playlist.

ref. #927 (comment)

@hooke007 You won't like that this is based on the file extension, but I don't know how else we would go about doing it. We could read the beginning of the file and deciding based on that, but I'd rather not do that unless it's very important to do that. I've checked if we could do something via mime-type (e.g. file --mime-type on linux), but m3u8 playlists simply show up as plain text, so we'd have to treat all text files as playlists.

@tomasklaen
Copy link
Owner

Too many lines :) Just do:

local command = has_any_extension(path, config.types.playlist) and 'loadlist' or 'loadfile'
if mods.ctrl then
	mp.commandv(command, path, 'append')
else
	mp.commandv(command, path)
	Menu:close()
end

Opening a playlist with loadfile can lead to problems like autoload.lua
populating the playlist with other files that were in the same directory
as the playlist file.

To avoid that the command loadlist can be used to avoid having mpv treat
the file like any other, just to notice during demuxing that it is a
playlist.
@christoph-heinrich
Copy link
Contributor Author

That was way too obvious... 😞

Want me to add you as co-author? would be kinda hilarious for such a simple change.

@tomasklaen tomasklaen merged commit c660db0 into tomasklaen:main Jul 9, 2024
@christoph-heinrich christoph-heinrich deleted the use_loadlist branch July 9, 2024 11:21
@mrfragger
Copy link

uosc 5.4.0 When clicking on .m3u8 playlist and opening with mpv it shows just the titles
image

If using uosc to navigate to .m3u8 and open it it shows the stream info also.
image

I hardly ever use iptv but if I do I'd just click on the m3u8 to open it so it's mostly a non-issue.

@tomasklaen
Copy link
Owner

We display playlist item titles if available, otherwise we fallback to the item's path/url. We do not set or manage titles, that is done by mpv or whatever populated the playlist entries.

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