diff options
Diffstat (limited to 'player/lua/ytdl_hook.lua')
-rw-r--r-- | player/lua/ytdl_hook.lua | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/player/lua/ytdl_hook.lua b/player/lua/ytdl_hook.lua index 7b0e9222e9..508c43f543 100644 --- a/player/lua/ytdl_hook.lua +++ b/player/lua/ytdl_hook.lua @@ -37,6 +37,20 @@ local function set_http_headers(http_headers) end end +local function append_rtmp_prop(props, name, value) + if not name or not value then + return props + end + + if props and props ~= "" then + props = props.."," + else + props = "" + end + + return props..name.."=\""..value.."\"" +end + mp.add_hook("on_load", 10, function () local url = mp.get_property("stream-open-filename") @@ -93,6 +107,13 @@ mp.add_hook("on_load", 10, function () table.insert(command, "--format") table.insert(command, format) end + + -- Checks if no-video option is set and disables video in ytdl if set + if (mp.get_property("options/vid") == "no") then + table.insert(command, "-x") + msg.verbose("Video disabled. Only using audio") + end + for param, arg in pairs(raw_options) do table.insert(command, "--" .. param) if (arg ~= "") then @@ -234,9 +255,13 @@ mp.add_hook("on_load", 10, function () -- for rtmp if not (json.play_path == nil) then - mp.set_property("file-local-options/stream-lavf-o", - "rtmp_tcurl=\""..streamurl.. - "\",rtmp_playpath=\""..json.play_path.."\"") + local rtmp_prop = append_rtmp_prop(nil, "rtmp_tcurl", streamurl) + rtmp_prop = append_rtmp_prop(rtmp_prop, "rtmp_pageurl", json.page_url) + rtmp_prop = append_rtmp_prop(rtmp_prop, "rtmp_playpath", json.play_path) + rtmp_prop = append_rtmp_prop(rtmp_prop, "rtmp_swfverify", json.player_url) + rtmp_prop = append_rtmp_prop(rtmp_prop, "rtmp_app", json.app) + + mp.set_property("file-local-options/stream-lavf-o", rtmp_prop) end end end |