]> git.sesse.net Git - ultimatescore/blobdiff - nageru/ultimate.lua
Set the replay title from the Futatabi queue status.
[ultimatescore] / nageru / ultimate.lua
index 8b266ed6679e845096611bdb94453759934e2b63..3045e6f4d745601bfd8131dd67eb2bb795c3ed06 100644 (file)
@@ -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 = {