fix empty tracks

This commit is contained in:
Franzi 2023-12-18 08:28:46 +01:00
parent ccfb13313b
commit 360b76b753

View file

@ -212,16 +212,16 @@ local function view_next_talk(starts, ends, config, x1, y1, x2, y2)
end end
end end
if show_track and current_talk.track then if show_track and current_talk.track ~= json.null then
local r,g,b,a = rgba(default_color, 1) local r,g,b,_ = rgba(default_color, 1)
if current_talk.track.color then if current_talk.track.color ~= json.null then
r,g,b = helper.parse_rgb(current_talk.track.color) r,g,b = helper.parse_rgb(current_talk.track["color"])
end end
if track_text then if track_text then
if a.height > y + 20 + track_size then if a.height > y + 20 + track_size then
text(font_text, col2, y+20, current_talk.track.name, track_size, r,g,b,1) text(font_text, col2, y+20, current_talk.track.name, track_size, r,g,b,1)
end end
elseif current_talk.track.color then elseif current_talk.track.color ~= json.null then
a.add(anims.moving_image_raw( a.add(anims.moving_image_raw(
S, E, resource.create_colored_texture(r,g,b,1), S, E, resource.create_colored_texture(r,g,b,1),
col2 - 25, 0, col2 - 25, 0,
@ -273,8 +273,6 @@ local function view_all_talks(starts, ends, config, x1, y1, x2, y2)
title = title .. " (" .. talk.locale .. ")" title = title .. " (" .. talk.locale .. ")"
end end
log(title .. " AA")
local title_lines = wrap( local title_lines = wrap(
title, title,
font_talk, title_size, a.width - col2 font_talk, title_size, a.width - col2
@ -298,8 +296,6 @@ local function view_all_talks(starts, ends, config, x1, y1, x2, y2)
break break
end end
log(title .. " BB")
-- time -- time
local talk_time local talk_time
local delta = talk.start_ts - time local delta = talk.start_ts - time
@ -315,15 +311,14 @@ local function view_all_talks(starts, ends, config, x1, y1, x2, y2)
local time_width = font_running:width(talk_time, time_size) local time_width = font_running:width(talk_time, time_size)
text(font_text, col2 - 35 - time_width, y, talk_time, time_size, rgba(default_color, 1)) text(font_text, col2 - 35 - time_width, y, talk_time, time_size, rgba(default_color, 1))
if show_track and talk.track then -- track
if talk.track.color then if show_track and talk.track ~= json.null and talk.track.color ~= json.null then
local r,g,b = helper.parse_rgb(talk.track.color) local r,g,b = helper.parse_rgb(talk.track.color)
a.add(anims.moving_image_raw( a.add(anims.moving_image_raw(
S, E, resource.create_colored_texture(r,g,b,1), S, E, resource.create_colored_texture(r,g,b,1),
col2 - 25, y, col2 - 25, y,
col2 - 10, y + #title_lines*title_size + 3 + #info_lines*info_size col2 - 10, y + #title_lines*title_size + 3 + #info_lines*info_size
)) ))
end
end end
-- title -- title