Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env astra_rusnoch
- pidfile("/var/run/rusnoch.pid")
- log.set({filename = "/var/log/rusnoch.log"})
- _interval = 1
- ch1 = nil
- ch2 = nil
- timer({
- interval = _interval,
- callback = function(self)
- local current_date_time = os.date("*t")
- local current_time = current_date_time.hour * 100 + current_date_time.min
- local is_channel_time = (current_time > 2300) or (current_time < 600)
- if (_interval < 60) then
- _interval = 60
- end
- if (is_channel_time == true) and (ch1 == nil) then
- kill_channel(ch2)
- ch2 = nil
- ch1 = make_channel({
- name = "rusnoch",
- input = {
- "udp://192.168.1.22@239.0.100.71:1234#map.pmt=100&map.video=101&map.rus=102",
- },
- output = {
- "udp://192.168.1.22@239.0.100.72:1234#sync",
- }
- })
- elseif (is_channel_time == false) and (ch2 == nil) then
- kill_channel(ch1)
- ch1 = nil
- ch2 = make_channel({
- name = "rusnoch",
- input = {
- "file:///usr/src/rusnoch/matras.ts#set_pnr=10205&map.pmt=100&map.video=101&map.rus=102&loop",
- },
- output = {
- "udp://192.168.1.22@239.0.100.72:1234#sync",
- }
- })
- end
- end
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement