Update 'sponsorblock_minimal.lua'

This commit is contained in:
jouni 2020-10-23 01:39:14 +02:00
parent 713074aea3
commit cc84f798ad
1 changed files with 9 additions and 11 deletions

View File

@ -25,10 +25,9 @@ function getranges()
if not string.match(sponsors.stdout,"%[(.-)%]") then return end
ranges = {}
for i in string.gmatch(string.sub(sponsors.stdout,2,-2),"%[(.-)%]") do
for k,v in string.gmatch(i,"(%d+.?%d*),(%d+.?%d*)") do
k,v = string.match(i,"(%d+.?%d*),(%d+.?%d*)")
ranges[k] = v
end
end
return
end
@ -65,17 +64,16 @@ function file_loaded()
end
function toggle()
if not ON then
mp.observe_property("time-pos", "native", skip_ads)
mp.osd_message("[Sponsorblock] on")
ON = true
return
end
if ON then
mp.unobserve_property(skip_ads)
mp.osd_message("[Sponsorblock] off")
ON = false
return
end
mp.observe_property("time-pos", "native", skip_ads)
mp.osd_message("[Sponsorblock] on")
ON = true
return
end
mp.register_event("file-loaded", file_loaded)