Advertisement
Cool_Lamer

astra ero chanel по времени

Sep 25th, 2016
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.62 KB | None | 0 0
  1. #!/usr/bin/env astra_rusnoch
  2.  
  3. pidfile("/var/run/rusnoch.pid")
  4. log.set({filename = "/var/log/rusnoch.log"})
  5.  
  6. _interval = 1
  7. ch1 = nil
  8. ch2 = nil
  9.  
  10. timer({
  11. interval = _interval,
  12.  
  13. callback = function(self)
  14. local current_date_time = os.date("*t")
  15. local current_time = current_date_time.hour * 100 + current_date_time.min
  16. local is_channel_time = (current_time > 2300) or (current_time < 600)
  17.  
  18. if (_interval < 60) then
  19. _interval = 60
  20. end
  21.  
  22.  
  23. if (is_channel_time == true) and (ch1 == nil) then
  24. kill_channel(ch2)
  25. ch2 = nil
  26. ch1 = make_channel({
  27. name = "rusnoch",
  28. input = {
  29. "udp://192.168.1.22@239.0.100.71:1234#map.pmt=100&map.video=101&map.rus=102",
  30. },
  31. output = {
  32. "udp://192.168.1.22@239.0.100.72:1234#sync",
  33. }
  34. })
  35.  
  36.  
  37. elseif (is_channel_time == false) and (ch2 == nil) then
  38. kill_channel(ch1)
  39. ch1 = nil
  40. ch2 = make_channel({
  41. name = "rusnoch",
  42. input = {
  43. "file:///usr/src/rusnoch/matras.ts#set_pnr=10205&map.pmt=100&map.video=101&map.rus=102&loop",
  44. },
  45. output = {
  46. "udp://192.168.1.22@239.0.100.72:1234#sync",
  47. }
  48. })
  49.  
  50. end
  51. end
  52. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement