summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Heinrich <christoph.heinrich@student.tugraz.at>2023-02-26 19:49:23 +0100
committerDudemanguy <random342@airmail.cc>2023-02-27 17:07:38 +0000
commit8ea7aa54719f790d64f3d96c63a7c8eaf756ca27 (patch)
tree77bbd68d110657aaa2080208c43330c193b0eb0c
parent42fd6f5f6f78a9cdd453d9a5263bb52dbb19d866 (diff)
downloadmpv-8ea7aa54719f790d64f3d96c63a7c8eaf756ca27.tar.bz2
mpv-8ea7aa54719f790d64f3d96c63a7c8eaf756ca27.tar.xz
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 cbb8f534b064f144820435148e516978de08cb30 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
-rw-r--r--player/lua/ytdl_hook.lua7
1 files changed, 5 insertions, 2 deletions
diff --git a/player/lua/ytdl_hook.lua b/player/lua/ytdl_hook.lua
index 9d1584016c..3cb5f654dd 100644
--- a/player/lua/ytdl_hook.lua
+++ b/player/lua/ytdl_hook.lua
@@ -47,6 +47,7 @@ local tag_list = {
-- (default --display-tags does not include this name)
["description"] = "ytdl_description",
-- "title" is handled by force-media-title
+ -- tags don't work with all_formats=yes
}
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("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
if max_bitrate > 0 and
@@ -925,7 +928,7 @@ function run_ytdl_hook(url)
set_http_headers(json.entries[1].http_headers)
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",
json.title)
end