Advertisement
IssyPutchy

TV Remote Control Lua

Apr 28th, 2019
320
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.25 KB | None | 0 0
  1. -- Let the shitstorm begin...
  2.  
  3. var_mode = 0
  4.  
  5. function update_vars()
  6.  running = wm_tag("{ttvinfo}")
  7.  var_s_running = tonumber(running)
  8.  tvhost = wm_tag("{ttvhost}")
  9.  var_s_ip = tostring(tvhost)
  10.  tvport = wm_tag("{ttvport}")
  11.  var_s_port = tostring(tvport)
  12. end
  13.  
  14. function volume(a)
  15.  if a == 0 then
  16.   wm_action('m_task:WMTV_Mute')
  17.    elseif a == 1 then
  18.   wm_action('m_task:WMTV_VolDown')
  19.    elseif a == 2 then
  20.   wm_action('m_task:WMTV_VolUp')
  21.  end
  22. end
  23.  
  24. function input(b)
  25.  if b == 0 then
  26.   wm_action('m_task:WMTV_CEC')
  27.    elseif b == 1 then
  28.   wm_action('m_task:WMTV_HDMI1')
  29.     elseif b == 2 then
  30.   wm_action('m_task:WMTV_HDMI2')
  31.  end
  32. end
  33.  
  34. function keys(c)
  35.  if c == 0 then
  36.   wm_action('m_task:WMTV_KeyUp')
  37.    elseif c == 1 then
  38.   wm_action('m_task:WMTV_KeyDown')
  39.    elseif c == 2 then
  40.   wm_action('m_task:WMTV_KeyLeft')
  41.    elseif c == 3 then
  42.   wm_action('m_task:WMTV_KeyRight')
  43.    elseif c == 4 then
  44.   wm_action('m_task:WMTV_KeyOK')
  45.    elseif c == 5 then
  46.   wm_action('m_task:WMTV_KeyBack')
  47.    elseif c == 6 then
  48.   wm_action('m_task:WMTV_KeyExit')
  49.  end
  50. end
  51.  
  52. function power()
  53.  wm_action('m_task:WMTV_Power')
  54. end
  55.  
  56. function findtv()
  57.  wm_action('m_task:AR_GetTVInfo')
  58. end
  59.  
  60. function on_second(h, m)
  61.  update_vars()
  62. end
  63.  
  64. update_vars()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement