From c70bf291fa8efc5975031d5c01f7282babeaaf9b Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Fri, 19 Oct 2018 23:04:30 +0200 Subject: [PATCH] Set the replay title from the Futatabi queue status. --- nageru/ultimate.lua | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/nageru/ultimate.lua b/nageru/ultimate.lua index 8b266ed..3045e6f 100644 --- a/nageru/ultimate.lua +++ b/nageru/ultimate.lua @@ -1,5 +1,10 @@ -- Nageru theme for TFK mini-tournament 2017, based on the default theme. +local http_request = require("http.request") +local cqueues = require("cqueues") +local cq = cqueues.new() +local futatabi_server = "http://gruessi.trd.sesse.net:9095" + local state = { transition_start = -2.0, transition_end = -1.0, @@ -34,6 +39,21 @@ local state = { } local NUM_CAMERAS = 6 -- Remember to update neutral_colors, too. +-- Update the Futatabi status in the title. +replay_title = "IPTV" +cq:wrap(function() + while true do + local headers, stream = assert(http_request.new_from_uri(futatabi_server .. "/queue_status"):go()) + replay_title = "IPTV" + if headers:get ":status" == "200" then + local body = assert(stream:get_body_as_string()) + if body then + replay_title = "IPTV " .. body + end + end + end +end) + -- Valid values for live_signal_num and preview_signal_num. local INPUT0_SIGNAL_NUM = 0 local INPUT1_SIGNAL_NUM = 1 @@ -485,7 +505,7 @@ function channel_name(channel) elseif signal_num == STATIC_SIGNAL_NUM then return "Static picture" elseif signal_num == VIDEO_SIGNAL_NUM then - return "IPTV input" + return replay_title elseif signal_num == OVERLAY_SIGNAL_NUM then return "Overlay" end @@ -823,6 +843,8 @@ local last_rate = 0.0 -- NOTE: The chain returned must be finalized with the Y'CbCr flag -- if and only if num==0. function get_chain(num, t, width, height, signals) + cq:loop(0) + local input_resolution = {} for signal_num=0,(NUM_CAMERAS-1) do local res = { -- 2.39.2