mirror of
https://github.com/Kunsi/scheduled-plugin-pretalx-broadcast-tools.git
synced 2024-11-25 19:41:04 +00:00
add option to display two room-specific images in "view info" tile
This commit is contained in:
parent
03de4e4ec2
commit
f9ee34ea5c
2 changed files with 76 additions and 37 deletions
16
node.json
16
node.json
|
@ -126,6 +126,22 @@
|
||||||
"hint": "Room-Specific text B",
|
"hint": "Room-Specific text B",
|
||||||
"rows": 6,
|
"rows": 6,
|
||||||
"default": ""
|
"default": ""
|
||||||
|
}, {
|
||||||
|
"title": "Image A",
|
||||||
|
"ui_width": 6,
|
||||||
|
"name": "image_a",
|
||||||
|
"hint": "Room-Specific image A",
|
||||||
|
"type": "resource",
|
||||||
|
"valid": ["image"],
|
||||||
|
"default": "empty.png"
|
||||||
|
}, {
|
||||||
|
"title": "Image B",
|
||||||
|
"ui_width": 6,
|
||||||
|
"name": "image_b",
|
||||||
|
"hint": "Room-Specific image B",
|
||||||
|
"type": "resource",
|
||||||
|
"valid": ["image"],
|
||||||
|
"default": "empty.png"
|
||||||
}]
|
}]
|
||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
|
|
35
tile.lua
35
tile.lua
|
@ -20,6 +20,8 @@ local room_next_talks = {}
|
||||||
local current_room
|
local current_room
|
||||||
local text_a
|
local text_a
|
||||||
local text_b
|
local text_b
|
||||||
|
local image_a
|
||||||
|
local image_b
|
||||||
local day = 0
|
local day = 0
|
||||||
local time = 0
|
local time = 0
|
||||||
local clock = "??"
|
local clock = "??"
|
||||||
|
@ -69,6 +71,8 @@ function M.updated_config_json(config)
|
||||||
current_room = room.name
|
current_room = room.name
|
||||||
text_a = room.text_a
|
text_a = room.text_a
|
||||||
text_b = room.text_b
|
text_b = room.text_b
|
||||||
|
image_a = resource.load_image(room.image_a)
|
||||||
|
image_b = resource.load_image(room.image_b)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -491,7 +495,8 @@ local function view_info(starts, ends, config, x1, y1, x2, y2)
|
||||||
local animate = config.info_animate or true
|
local animate = config.info_animate or true
|
||||||
local default_color = {helper.parse_rgb(config.color or "#ffffff")}
|
local default_color = {helper.parse_rgb(config.color or "#ffffff")}
|
||||||
local r,g,b = helper.parse_rgb(config.color or "#ffffff")
|
local r,g,b = helper.parse_rgb(config.color or "#ffffff")
|
||||||
local text_source = config.info_text_source or "a"
|
-- keep this as "info_text_source" to not break existing setups
|
||||||
|
local info_source = config.info_text_source or "a"
|
||||||
|
|
||||||
local a = anims.Area(x2 - x1, y2 - y1)
|
local a = anims.Area(x2 - x1, y2 - y1)
|
||||||
|
|
||||||
|
@ -502,13 +507,21 @@ local function view_info(starts, ends, config, x1, y1, x2, y2)
|
||||||
return a.add(anims.moving_font(S, E, ...))
|
return a.add(anims.moving_font(S, E, ...))
|
||||||
end
|
end
|
||||||
|
|
||||||
local info_text = text_a
|
local info_mode = "text"
|
||||||
if text_source == "b" then
|
local info_content = text_a
|
||||||
info_text = text_b
|
if info_source == "b" then
|
||||||
|
info_content = text_b
|
||||||
|
elseif info_source == "image_a" then
|
||||||
|
info_mode = "image"
|
||||||
|
info_content = image_a
|
||||||
|
elseif info_source == "image_b" then
|
||||||
|
info_mode = "image"
|
||||||
|
info_content = image_b
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if info_mode == "text" then
|
||||||
local y = 0
|
local y = 0
|
||||||
for line in string.gmatch(info_text.."\n", "([^\n]*)\n") do
|
for line in string.gmatch(info_content.."\n", "([^\n]*)\n") do
|
||||||
if line ~= "" then
|
if line ~= "" then
|
||||||
local lines = wrap(
|
local lines = wrap(
|
||||||
line,
|
line,
|
||||||
|
@ -538,7 +551,7 @@ local function view_info(starts, ends, config, x1, y1, x2, y2)
|
||||||
a.draw(now, x1, y1, x2, y2)
|
a.draw(now, x1, y1, x2, y2)
|
||||||
else
|
else
|
||||||
local y = 0
|
local y = 0
|
||||||
for line in string.gmatch(info_text.."\n", "([^\n]*)\n") do
|
for line in string.gmatch(info_content.."\n", "([^\n]*)\n") do
|
||||||
local lines = wrap(
|
local lines = wrap(
|
||||||
line,
|
line,
|
||||||
font_text, font_size, a.width
|
font_text, font_size, a.width
|
||||||
|
@ -560,6 +573,16 @@ local function view_info(starts, ends, config, x1, y1, x2, y2)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
a.moving_image(S, E, info_content, x1, y1, x2, y2)
|
||||||
|
for now in api.frame_between(starts, ends) do
|
||||||
|
if animate then
|
||||||
|
a.draw(now, x1, y1, x2, y2)
|
||||||
|
else
|
||||||
|
util.draw_correct(info_content, x1, y1, x2, y2)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.task(starts, ends, config, x1, y1, x2, y2)
|
function M.task(starts, ends, config, x1, y1, x2, y2)
|
||||||
|
|
Loading…
Reference in a new issue