mirror of https://github.com/mpv-player/mpv
ytdl_hook: don't overwrite force-media-title
ytdl_hook always set force-media-title, making users unable to force
a media-title via options.
To prevent that, check if force-media-title is already set to avoid
overwriting it.
A better solution would be to use tags like is already done for some
metadata, however that doesn't work when `all_formats=yes` is used.
See cbb8f534b0
A comment was added to hint at why it isn't done via tags.
ref.
https://github.com/mpv-player/mpv/pull/10453#issuecomment-1445277496
This commit is contained in:
parent
42fd6f5f6f
commit
8ea7aa5471
|
@ -47,6 +47,7 @@ local tag_list = {
|
||||||
-- (default --display-tags does not include this name)
|
-- (default --display-tags does not include this name)
|
||||||
["description"] = "ytdl_description",
|
["description"] = "ytdl_description",
|
||||||
-- "title" is handled by force-media-title
|
-- "title" is handled by force-media-title
|
||||||
|
-- tags don't work with all_formats=yes
|
||||||
}
|
}
|
||||||
|
|
||||||
local safe_protos = Set {
|
local safe_protos = Set {
|
||||||
|
@ -629,7 +630,9 @@ local function add_single_video(json)
|
||||||
|
|
||||||
mp.set_property("stream-open-filename", streamurl:gsub("^data:", "data://", 1))
|
mp.set_property("stream-open-filename", streamurl:gsub("^data:", "data://", 1))
|
||||||
|
|
||||||
mp.set_property("file-local-options/force-media-title", json.title)
|
if mp.get_property("force-media-title", "") == "" then
|
||||||
|
mp.set_property("file-local-options/force-media-title", json.title)
|
||||||
|
end
|
||||||
|
|
||||||
-- set hls-bitrate for dash track selection
|
-- set hls-bitrate for dash track selection
|
||||||
if max_bitrate > 0 and
|
if max_bitrate > 0 and
|
||||||
|
@ -925,7 +928,7 @@ function run_ytdl_hook(url)
|
||||||
set_http_headers(json.entries[1].http_headers)
|
set_http_headers(json.entries[1].http_headers)
|
||||||
|
|
||||||
mp.set_property("stream-open-filename", playlist)
|
mp.set_property("stream-open-filename", playlist)
|
||||||
if not (json.title == nil) then
|
if json.title and mp.get_property("force-media-title", "") == "" then
|
||||||
mp.set_property("file-local-options/force-media-title",
|
mp.set_property("file-local-options/force-media-title",
|
||||||
json.title)
|
json.title)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue