Advertisement
Guest User

Untitled

a guest
Jun 15th, 2022
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.96 KB | None | 0 0
  1. -- Script will pause at the beginning of each new subtitle for the amount of time that
  2. -- the subtitle would normally appear on the screen, multiplied by FACTOR.
  3. -- So if a sub was going to appear for 4 seconds and you have a FACTOR of 0.5 then
  4. -- then there will be a 2 second pause when that subtitle appears.
  5. local FACTOR = 0.5
  6.  
  7. local pause_disease = false
  8.  
  9. function pause(a, b)
  10.   if not pause_disease then
  11.     return
  12.   end
  13.  
  14.   if b ~= "" then
  15.     mp.set_property_native("pause", true)
  16.     local pause_length = FACTOR * (mp.get_property_number('sub-end') - mp.get_property_number('sub-start'))
  17.     mp.add_timeout(pause_length, function()  mp.set_property_native("pause", false) end)
  18.   end
  19. end
  20.  
  21. function toggle_pause_disease()
  22.   pause_disease = not pause_disease
  23.   mp.osd_message("Pause disease " .. (pause_disease and "activated" or "deactived"), 3)
  24. end
  25.  
  26.  
  27. mp.add_key_binding("ctrl+p", toggle_pause_disease)
  28. mp.observe_property("sub-text", 'string', pause)
  29.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement