summaryrefslogtreecommitdiffstats
path: root/player
diff options
context:
space:
mode:
authorRicardo Constantino <wiiaboo@gmail.com>2016-09-11 16:47:05 +0100
committerwm4 <wm4@nowhere>2016-09-13 09:23:00 +0200
commit60a0815b4c86f72119d558215518e5707ab664ae (patch)
treef6a14583bc410349e390407fb32979c051da2914 /player
parent5edd6a8caa45a1e31db942c1dee8dc2835822804 (diff)
downloadmpv-60a0815b4c86f72119d558215518e5707ab664ae.tar.bz2
mpv-60a0815b4c86f72119d558215518e5707ab664ae.tar.xz
ytdl_hook: don't bother adding subtitles if duration isn't known
EDL doesn't work with subtitles with unknown length.
Diffstat (limited to 'player')
-rw-r--r--player/lua/ytdl_hook.lua8
1 files changed, 3 insertions, 5 deletions
diff --git a/player/lua/ytdl_hook.lua b/player/lua/ytdl_hook.lua
index c60c1bfe9a..04777b97cf 100644
--- a/player/lua/ytdl_hook.lua
+++ b/player/lua/ytdl_hook.lua
@@ -189,7 +189,8 @@ mp.add_hook("on_load", 10, function ()
end
end
- if not (entry_wsubs == nil) then
+ if not (entry_wsubs == nil) and
+ not (json.entries[entry_wsubs].duration == nil) then
for j, req in pairs(json.entries[entry_wsubs].requested_subtitles) do
local subfile = "edl://"
for i, entry in pairs(json.entries) do
@@ -199,10 +200,7 @@ mp.add_hook("on_load", 10, function ()
else
subfile = subfile..edl_escape("memory://WEBVTT")
end
- if not (entry.duration == nil) then
- subfile = subfile..",start=0,length="..entry.duration
- end
- subfile = subfile .. ";"
+ subfile = subfile..",start=0,length="..entry.duration..";"
end
msg.debug(j.." sub EDL: "..subfile)
mp.commandv("sub-add", subfile, "auto", req.ext, j)