diff options
author | Martin Herkt <lachs0r@srsfckn.biz> | 2016-06-25 02:25:44 +0200 |
---|---|---|
committer | Martin Herkt <lachs0r@srsfckn.biz> | 2016-06-25 02:25:44 +0200 |
commit | ad56f2c46ac6deec86870ec10f2a11a644df07d4 (patch) | |
tree | 89f2d90c5586560911e67c872b530c77f151168d /player/lua/ytdl_hook.lua | |
parent | 0536841647ef7931bffb4386d8ffbb5b2b568e8a (diff) | |
parent | 393bb2a565dc1e27812e1dd20747814892f80da2 (diff) | |
download | mpv-ad56f2c46ac6deec86870ec10f2a11a644df07d4.tar.bz2 mpv-ad56f2c46ac6deec86870ec10f2a11a644df07d4.tar.xz |
Merge branch 'master' into release/current
Diffstat (limited to 'player/lua/ytdl_hook.lua')
-rw-r--r-- | player/lua/ytdl_hook.lua | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/player/lua/ytdl_hook.lua b/player/lua/ytdl_hook.lua index c0ce8b97c4..9f94951893 100644 --- a/player/lua/ytdl_hook.lua +++ b/player/lua/ytdl_hook.lua @@ -153,13 +153,18 @@ mp.add_hook("on_load", 10, function () -- some funky guessing to detect multi-arc videos - if not (json.entries[1]["webpage_url"] == nil) - and (json.entries[1]["webpage_url"] == json["webpage_url"]) then + if (not (json.entries[1]["_type"] == "url_transparent")) and + (not (json.entries[1]["webpage_url"] == nil) + and (json.entries[1]["webpage_url"] == json["webpage_url"])) then msg.verbose("multi-arc video detected, building EDL") local playlist = "edl://" for i, entry in pairs(json.entries) do - playlist = playlist .. edl_escape(entry.url) .. ";" + playlist = playlist .. edl_escape(entry.url) + if not (entry.duration == nil) then + playlist = playlist..",start=0,length="..entry.duration + end + playlist = playlist .. ";" end msg.debug("EDL: " .. playlist) @@ -175,6 +180,21 @@ mp.add_hook("on_load", 10, function () json.title) end + if not (json.entries[1].requested_subtitles == nil) then + for j, req in pairs(json.entries[1].requested_subtitles) do + local subfile = "edl://" + for i, entry in pairs(json.entries) do + subfile = subfile..edl_escape(entry.requested_subtitles[j].url) + if not (entry.duration == nil) then + subfile = subfile..",start=0,length="..entry.duration + end + subfile = subfile .. ";" + end + msg.debug(j.." sub EDL: "..subfile) + mp.commandv("sub-add", subfile, "auto", req.ext, j) + end + end + else local playlist = "#EXTM3U\n" @@ -186,7 +206,8 @@ mp.add_hook("on_load", 10, function () -- directly to the file in that case, which we don't -- want so get the webpage URL instead, which is what -- we want - if not (entry["webpage_url"] == nil) then + if not (json.entries[1]["_type"] == "url_transparent") + and not (entry["webpage_url"] == nil) then site = entry["webpage_url"] end @@ -253,7 +274,7 @@ mp.add_hook("on_load", 10, function () end -- for rtmp - if not (json.play_path == nil) then + if (json.protocol == "rtmp") then local rtmp_prop = append_rtmp_prop(nil, "rtmp_tcurl", streamurl) rtmp_prop = append_rtmp_prop(rtmp_prop, |