Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Simple DVR for Astra-4 and Astra-5
- -- Usage:
- -- - Download Astra: http://cesbo.com/download/
- -- - Save this script into: dvr.lua
- -- - Launch: astra dvr.lua "INPUT"
- local channel_instance = nil
- local input_addr = ""
- local current_hour = -1
- function stop()
- if channel_instance then
- kill_channel(channel_instance)
- channel_instance = nil
- end
- end
- function start()
- local current_date = os.date("*t")
- if current_hour == current_date.hour then
- return nil
- end
- current_hour = current_date.hour
- if channel_instance then
- stop()
- end
- channel_instance = make_channel({
- name = "DVR",
- input = { input_addr },
- output = { "file://" .. os.date("%H-%d-%m-%Y") .. ".ts" },
- })
- end
- options = {
- ["*"] = function(idx)
- input_addr = argv[idx]
- return 0
- end,
- }
- function main()
- log.info("Starting Astra " .. astra.version)
- if not input_addr then
- log.error("Usage: astra dvr.lua INPUT")
- astra.exit()
- end
- start()
- timer({
- interval = 10,
- callback = start,
- })
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement