Advertisement
Guest User

Untitled

a guest
Dec 5th, 2019
357
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.89 KB | None | 0 0
  1. #!/usr/bin/env /home/astra/astra
  2.  
  3. playlist = {}
  4. ts_path = "/home/tv/static/upload/testing/"
  5.         for val in utils.readdir(ts_path) do
  6.         f_path = ts_path .. val
  7.         table.insert(playlist, f_path)
  8.         log.info(f_path)
  9. end
  10.  
  11. instance = { item = 0, input = nil, output = nil, }
  12.  
  13. function play_next_item();
  14.     if instance.item == #playlist then
  15.         instance.item = 1
  16.     else
  17.         instance.item = instance.item + 1
  18.     end
  19.  
  20.     -- if instance.input then instance.input = nil end
  21.     if instance.output then instance.output = nil end
  22.     collectgarbage();
  23.  
  24.     instance.input = file_input({
  25.         filename = playlist[instance.item],
  26.         loop = false,
  27.         callback = play_next_item
  28.     })
  29.  
  30.     instance.output = udp_output({
  31.         upstream = instance.input:stream(),
  32.         addr = "239.0.23.255",
  33.         port = 1234
  34.     })
  35. end
  36.  
  37. play_next_item();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement