Fix continuous seeking for a tiny amount (e.g. 0.002s)

This commit is contained in:
blankie 2023-09-22 20:45:14 +10:00
parent 8bcc5d180d
commit 1087729c5f
Signed by: blankie
GPG Key ID: CC15FC822C7F61F5
1 changed files with 4 additions and 3 deletions

View File

@ -70,7 +70,9 @@ function observePlaybackTime(_, current_pos)
end end
for _, segment in pairs(video_data.segments) do for _, segment in pairs(video_data.segments) do
local seek_offset = segment.segment[2] - current_pos
if current_pos >= segment.segment[1] and segment.segment[2] > current_pos if current_pos >= segment.segment[1] and segment.segment[2] > current_pos
and seek_offset >= 0.01
and segment.category ~= "full" and segment.category ~= "full"
and inTableValue(split(options.categories), segment.category) then and inTableValue(split(options.categories), segment.category) then
local category_name = segment.category local category_name = segment.category
@ -79,8 +81,7 @@ function observePlaybackTime(_, current_pos)
end end
if segment.actionType == "skip" then if segment.actionType == "skip" then
mp.osd_message("[sponsorblock] Skipping " .. segment.segment[2] - current_pos mp.osd_message("[sponsorblock] Skipping " .. seek_offset .. "s " .. category_name)
.. "s " .. category_name)
mp.set_property_number("playback-time", segment.segment[2]) mp.set_property_number("playback-time", segment.segment[2])
current_pos = segment.segment[2] current_pos = segment.segment[2]
elseif segment.actionType == "mute" then elseif segment.actionType == "mute" then