diff options
author | Arnold Stanovský <stanoarn@fit.cvut.cz> | 2023-04-10 20:42:12 +0200 |
---|---|---|
committer | Dudemanguy <random342@airmail.cc> | 2023-04-12 02:14:09 +0000 |
commit | c50f536bd1ac1f8154d2b1dcaccd25ab150b414a (patch) | |
tree | 7ea3a758a8ad8aef0dd6a894f67b42fd2583f2d9 /player/lua/ytdl_hook.lua | |
parent | b573a4967d55af45500ea34aa5beb174c460e49a (diff) | |
download | mpv-c50f536bd1ac1f8154d2b1dcaccd25ab150b414a.tar.bz2 mpv-c50f536bd1ac1f8154d2b1dcaccd25ab150b414a.tar.xz |
ytdl_hook: fix clip start and end
Diffstat (limited to 'player/lua/ytdl_hook.lua')
-rw-r--r-- | player/lua/ytdl_hook.lua | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/player/lua/ytdl_hook.lua b/player/lua/ytdl_hook.lua index 77f7446ed2..6a3c6d8530 100644 --- a/player/lua/ytdl_hook.lua +++ b/player/lua/ytdl_hook.lua @@ -693,11 +693,21 @@ local function add_single_video(json) end -- set start time - if not (json.start_time == nil) and + if (json.start_time or json.section_start) and not option_was_set("start") and not option_was_set_locally("start") then - msg.debug("Setting start to: " .. json.start_time .. " secs") - mp.set_property("file-local-options/start", json.start_time) + local start_time = json.start_time or json.section_start + msg.debug("Setting start to: " .. start_time .. " secs") + mp.set_property("file-local-options/start", start_time) + end + + -- set end time + if (json.end_time or json.section_end) and + not option_was_set("end") and + not option_was_set_locally("end") then + local end_time = json.end_time or json.section_end + msg.debug("Setting end to: " .. end_time .. " secs") + mp.set_property("file-local-options/end", end_time) end -- set aspect ratio for anamorphic video |