Advertisement
Guest User

Untitled

a guest
Aug 3rd, 2020
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.46 KB | None | 0 0
  1.  
  2. function escape(s)
  3.   return (s:gsub('\'', '\'\\\'\''))
  4. end
  5.  
  6. local function copy_subs()
  7.     local subs = mp.get_property('sub-text')
  8.    
  9.     if type(subs) ~= 'string' then
  10.         return
  11.     end
  12.    
  13.     subs = subs:gsub('\n', '')
  14.     local a = "export LANG=en_US.UTF-8; echo '" .. escape(subs) .. "' | xclip -selection c"
  15.     os.execute(a)
  16.                
  17.     mp.osd_message('Subs copied.')
  18. end
  19.  
  20. mp.add_key_binding('ctrl+c', 'ctrl+c', copy_subs)
  21.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement