diff --git a/sponsorblock_lm.lua b/sponsorblock_lm.lua index 0f35666..d334f55 100644 --- a/sponsorblock_lm.lua +++ b/sponsorblock_lm.lua @@ -70,7 +70,9 @@ function observePlaybackTime(_, current_pos) end 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 + and seek_offset >= 0.01 and segment.category ~= "full" and inTableValue(split(options.categories), segment.category) then local category_name = segment.category @@ -79,8 +81,7 @@ function observePlaybackTime(_, current_pos) end if segment.actionType == "skip" then - mp.osd_message("[sponsorblock] Skipping " .. segment.segment[2] - current_pos - .. "s " .. category_name) + mp.osd_message("[sponsorblock] Skipping " .. seek_offset .. "s " .. category_name) mp.set_property_number("playback-time", segment.segment[2]) current_pos = segment.segment[2] elseif segment.actionType == "mute" then @@ -200,7 +201,7 @@ function getSegments(video_id) .. percentEncodeComponent(utils.format_json(split(options.categories))) proc = mp.command_native({ name = "subprocess", - args = {"curl", "--silent", "--show-error", "--globoff", url}, + args = {"curl", "--silent", "--show-error", "--globoff", url}, playback_only = true, capture_stdout = true, capture_stderr = false