mirror of
https://github.com/Kunsi/scheduled-plugin-pretalx-broadcast-tools.git
synced 2024-12-22 00:02:44 +00:00
add text blocks to room info
This commit is contained in:
parent
a1d635fcd0
commit
d17d8f1f23
3 changed files with 118 additions and 1 deletions
16
node.json
16
node.json
|
@ -97,6 +97,22 @@
|
|||
"name": "serial",
|
||||
"type": "device",
|
||||
"default": ""
|
||||
}, {
|
||||
"title": "Text block A",
|
||||
"ui_width": 6,
|
||||
"name": "text_a",
|
||||
"type": "text",
|
||||
"hint": "Room-Specific text A",
|
||||
"rows": 6,
|
||||
"default": ""
|
||||
}, {
|
||||
"title": "Text block B",
|
||||
"ui_width": 6,
|
||||
"name": "text_b",
|
||||
"type": "text",
|
||||
"hint": "Room-Specific text B",
|
||||
"rows": 6,
|
||||
"default": ""
|
||||
}]
|
||||
}]
|
||||
}
|
||||
|
|
34
tile.js
34
tile.js
|
@ -12,6 +12,7 @@ var config = {
|
|||
<option value="room">Room Name</option>
|
||||
<option value="day">Day</option>
|
||||
<option value="clock">Clock</option>
|
||||
<option value="info">Info text</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class='col-xs-3'>
|
||||
|
@ -128,6 +129,33 @@ var config = {
|
|||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<template v-if='mode == "info"'>
|
||||
<h4>Info options</h4>
|
||||
<div class='row'>
|
||||
<div class='col-xs-3'>
|
||||
Alignment<br/>
|
||||
<select class='btn btn-default' v-model="info_align">
|
||||
<option value="left">Align left</option>
|
||||
<option value="center">Align centered</option>
|
||||
<option value="right">Align right</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class='col-xs-3'>
|
||||
Text source<br/>
|
||||
<select class='btn btn-default' v-model="info_text_source">
|
||||
<option value="a">Text A</option>
|
||||
<option value="b">Text B</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class='col-xs-3'>
|
||||
<input
|
||||
type="checkbox"
|
||||
v-model="info_animate"
|
||||
class='form-check-input'/>
|
||||
Fade in and out
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
`,
|
||||
computed: {
|
||||
|
@ -144,11 +172,15 @@ var config = {
|
|||
room_animate: ChildTile.config_value('room_animate', true),
|
||||
|
||||
clock_align: ChildTile.config_value('clock_align', 'left'),
|
||||
clock_animate: ChildTile.config_value('clock_animate', true),
|
||||
clock_animate: ChildTile.config_value('clock_animate', false),
|
||||
|
||||
day_align: ChildTile.config_value('day_align', 'left'),
|
||||
day_template: ChildTile.config_value('day_template', 'Day %d'),
|
||||
day_animate: ChildTile.config_value('day_animate', false),
|
||||
|
||||
info_align: ChildTile.config_value('info_align', 'left'),
|
||||
info_animate: ChildTile.config_value('info_animate', true),
|
||||
info_text_source: ChildTile.config_value('info_text_source', 'a'),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
69
tile.lua
69
tile.lua
|
@ -17,6 +17,8 @@ local rooms = {}
|
|||
local all_next_talks = {}
|
||||
local room_next_talks = {}
|
||||
local current_room
|
||||
local text_a
|
||||
local text_b
|
||||
local day = 0
|
||||
local time = 0
|
||||
local clock = "??"
|
||||
|
@ -61,6 +63,8 @@ function M.updated_config_json(config)
|
|||
if room.serial == sys.get_env "SERIAL" then
|
||||
log("found my room: ", room.name)
|
||||
current_room = room.name
|
||||
text_a = room.text_a
|
||||
text_b = room.text_b
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -450,6 +454,70 @@ local function view_day(starts, ends, config, x1, y1, x2, y2)
|
|||
end
|
||||
end
|
||||
|
||||
local function view_info(starts, ends, config, x1, y1, x2, y2)
|
||||
local font_size = config.font_size or 70
|
||||
local align = config.info_align or "left"
|
||||
local animate = config.info_animate or true
|
||||
local default_color = {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"
|
||||
|
||||
local a = anims.Area(x2 - x1, y2 - y1)
|
||||
|
||||
local S = starts
|
||||
local E = ends
|
||||
|
||||
local function text(...)
|
||||
return a.add(anims.moving_font(S, E, ...))
|
||||
end
|
||||
|
||||
local info_text = text_a
|
||||
if text_source == "b" then
|
||||
info_text = text_b
|
||||
end
|
||||
|
||||
local lines = wrap(
|
||||
info_text,
|
||||
font_text, font_size, a.width
|
||||
)
|
||||
|
||||
local y = 0
|
||||
for idx = 1, #lines do
|
||||
local x = 0
|
||||
local w = font_text:width(lines[idx], font_size)
|
||||
|
||||
if align == "right" then
|
||||
x = a.width - w
|
||||
elseif align == "center" then
|
||||
x = (a.width - w) / 2
|
||||
end
|
||||
|
||||
text(font_text, x, y, lines[idx], font_size, rgba(default_color,.8))
|
||||
y = y + font_size
|
||||
end
|
||||
|
||||
for now in api.frame_between(starts, ends) do
|
||||
if animate then
|
||||
a.draw(now, x1, y1, x2, y2)
|
||||
else
|
||||
local y = 0
|
||||
for idx = 1, #lines do
|
||||
local x = 0
|
||||
local w = font_text:width(lines[idx], font_size)
|
||||
|
||||
if align == "right" then
|
||||
x = a.width - w
|
||||
elseif align == "center" then
|
||||
x = (a.width - w) / 2
|
||||
end
|
||||
|
||||
font_text:write(x, y, lines[idx], font_size, r,g,b,1)
|
||||
y = y + font_size
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function M.task(starts, ends, config, x1, y1, x2, y2)
|
||||
check_next_talks()
|
||||
return ({
|
||||
|
@ -459,6 +527,7 @@ function M.task(starts, ends, config, x1, y1, x2, y2)
|
|||
room = view_room,
|
||||
day = view_day,
|
||||
clock = view_clock,
|
||||
info = view_info,
|
||||
})[config.mode or 'all_talks'](starts, ends, config, x1, y1, x2, y2)
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue