mirror of
https://github.com/mpv-player/mpv.git
synced 2025-12-28 05:33:14 +00:00
player: add playlist-path properties
A bit of a long standing pain with scripting is that when opening a file that gets interpreted as a playlist (like an m3u), the original path of the file gets thrown away later. Workarounds basically consist of getting the filename before mpv expands the path, but that's not really reliable. Instead of throwing it away, save the original playlist path by copying to the playlist entries when applicable (demuxer playlist and the playlist option). Then expose these as properties: playlist-path for the currently playing entry and playlist/N/playlist-path for each specific entry. Closes #8508, #7605.
This commit is contained in:
@@ -194,13 +194,15 @@ int m_config_parse_mp_command_line(m_config_t *config, struct playlist *files,
|
||||
// append the playlist to the local args
|
||||
char *param0 = bstrdup0(NULL, p.param);
|
||||
struct playlist *pl = playlist_parse_file(param0, NULL, global);
|
||||
talloc_free(param0);
|
||||
if (!pl) {
|
||||
MP_FATAL(config, "Error reading playlist '%.*s'\n",
|
||||
BSTR_P(p.param));
|
||||
talloc_free(param0);
|
||||
goto err_out;
|
||||
}
|
||||
playlist_transfer_entries(files, pl);
|
||||
playlist_populate_playlist_path(files, param0);
|
||||
talloc_free(param0);
|
||||
talloc_free(pl);
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user