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