feat: use loadlist when opening playlists (#929)

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.
This commit is contained in:
christoph-heinrich
2024-07-09 09:29:00 +02:00
committed by GitHub
parent 3bf774bf54
commit c660db0743
2 changed files with 4 additions and 2 deletions

View File

@@ -591,10 +591,11 @@ function open_open_file_menu()
menu = open_file_navigation_menu(
directory,
function(path, mods)
local command = has_any_extension(path, config.types.playlist) and 'loadlist' or 'loadfile'
if mods.ctrl then
mp.commandv('loadfile', path, 'append')
mp.commandv(command, path, 'append')
else
mp.commandv('loadfile', path)
mp.commandv(command, path)
Menu:close()
end
end,

View File

@@ -188,6 +188,7 @@ config = {
audio = comma_split(options.audio_types),
image = comma_split(options.image_types),
subtitle = comma_split(options.subtitle_types),
playlist = comma_split(options.playlist_types),
media = comma_split(options.video_types
.. ',' .. options.audio_types
.. ',' .. options.image_types