Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Category - poi_highlight #42

Open
Obegg opened this issue Aug 28, 2021 · 5 comments · May be fixed by #71
Open

New Category - poi_highlight #42

Obegg opened this issue Aug 28, 2021 · 5 comments · May be fixed by #71

Comments

@Obegg
Copy link

Obegg commented Aug 28, 2021

https://github.com/ajayyy/SponsorBlock/wiki/Types#category

image

poi_highlight

Video with the new category:
https://www.youtube.com/watch?v=zF2KF-SVIXc

How can I use it on MPV?

I tried to add "poi_highlight" to "skip categories", it does fetch that, but it doesn't skip TO IT, since the script only skips FROM IT.
This one is tricky to use since the start and end times are equal, so somehow the script will need to skip to that point (highlight) from the start of the video.

@po5
Copy link
Owner

po5 commented Sep 1, 2021

Did notice the new feature while using the browser extension and not sure how to implement this.
I think just a chapter marker is fine, letting you use your mpv seeking bindings to jump to that chapter. Just need to check if it already works with the current code.

@Obegg
Copy link
Author

Obegg commented Sep 1, 2021

Did notice the new feature while using the browser extension and not sure how to implement this.
I think just a chapter marker is fine, letting you use your mpv seeking bindings to jump to that chapter. Just need to check if it already works with the current code.

I don't think that "chapter marker" is enough for this one.
The whole point of "highlight" is that the VIDEO WILL START FROM that chapter.
Meaning the script will need to identify the "highlight" and SKIP TO IT accordingly.

@pukkandan
Copy link

pukkandan commented Dec 21, 2021

There will always only be atmost one poi_highlight per video, so the script could mark 0 to highlight as a chapter and skip it. The feature should be opt-in though and should not be enabled by default imo

@alopatindev
Copy link

alopatindev commented Nov 26, 2023

Dirty workaround for anyone interested:

diff --git a/sponsorblock.lua b/sponsorblock.lua
index 96bfb24..efe86df 100644
--- a/sponsorblock.lua
+++ b/sponsorblock.lua
@@ -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
@@ -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,
@@ -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
# ~/.config/mpv/script-opts/sponsorblock.conf
skip_categories=sponsor,intro,outro,interaction,selfpromo,preview,music_offtopic,filler,poi_highlight
categories=sponsor,intro,outro,interaction,selfpromo,filler,preview,music_offtopic,poi_highlight

@Obegg
Copy link
Author

Obegg commented Nov 26, 2023

It doesn't seem like a "workaround", it looks like a solution, will you be able to send a PR for this?

@alopatindev alopatindev linked a pull request Nov 26, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants