Skip to content

Commit

Permalink
Implement auto skip to highlight/point of interest
Browse files Browse the repository at this point in the history
  • Loading branch information
alopatindev committed Nov 26, 2023
1 parent 7785c14 commit 981593f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions sponsorblock.lua
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ local fade_timer = nil
local fade_dir = nil
local volume_before = mp.get_property_number("volume")
local categories = {}
local all_categories = {"sponsor", "intro", "outro", "interaction", "selfpromo", "preview", "music_offtopic", "filler"}
local all_categories = {"sponsor", "intro", "outro", "interaction", "selfpromo", "preview", "music_offtopic", "filler", "poi_highlight"}
local chapter_cache = {}

for category in string.gmatch(options.skip_categories, "([^,]+)") do
Expand Down Expand Up @@ -182,7 +182,7 @@ function process(uuid, t, new_ranges)
end
end
category = string.match(t, "[^,]+$")
if categories[category] and end_time - start_time >= options.min_duration then
if categories[category] and (end_time - start_time >= options.min_duration or category == 'poi_highlight') then
new_ranges[uuid] = {
start_time = start_time,
end_time = end_time,
Expand Down Expand Up @@ -282,6 +282,10 @@ function skip_ads(name, pos)
if pos == nil then return end
local sponsor_ahead = false
for uuid, t in pairs(ranges) do
if t.category == "poi_highlight" and not t.skipped then
t.skipped = true
mp.set_property("time-pos", t.end_time)
end
if (options.fast_forward == uuid or not options.skip_once or not t.skipped) and t.start_time <= pos and t.end_time > pos then
if options.fast_forward == uuid then return end
if options.fast_forward == false then
Expand Down

0 comments on commit 981593f

Please sign in to comment.