diff options
author | Ricardo Constantino <wiiaboo@gmail.com> | 2016-05-22 22:18:27 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2016-05-23 15:14:14 +0200 |
commit | 4ff2a606322494f060b90a982cbe2342738db665 (patch) | |
tree | 09b72bbf5697faa31e459cab6905fc082179c7bb /player/lua/ytdl_hook.lua | |
parent | 4aa017e3013ea2755fc48886faaf3601bde13ddd (diff) | |
download | mpv-4ff2a606322494f060b90a982cbe2342738db665.tar.bz2 mpv-4ff2a606322494f060b90a982cbe2342738db665.tar.xz |
ytdl_hook: support multi-arc subtitles
While at it, pass durations of segments from ytdl if available.
Diffstat (limited to 'player/lua/ytdl_hook.lua')
-rw-r--r-- | player/lua/ytdl_hook.lua | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/player/lua/ytdl_hook.lua b/player/lua/ytdl_hook.lua index 97ce02dab8..fb59aa3301 100644 --- a/player/lua/ytdl_hook.lua +++ b/player/lua/ytdl_hook.lua @@ -159,7 +159,11 @@ mp.add_hook("on_load", 10, function () 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 +179,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" |