Tabellone, badge e brand sono ricodificati nel flusso _air via OverlayRelay; sync punteggio HTTP, volume condiviso rails/sidekiq, qualità 720p migliorata e badge CONNECTING in ripresa da pausa. Co-authored-by: Cursor <cursoragent@cursor.com>
36 lines
819 B
Ruby
36 lines
819 B
Ruby
module Streams
|
|
module Overlay
|
|
module_function
|
|
|
|
def overlay_dir(session_id)
|
|
Rails.root.join("tmp/stream_overlays", session_id.to_s)
|
|
end
|
|
|
|
def overlay_png_path(session)
|
|
overlay_dir(session.id).join("overlay.png")
|
|
end
|
|
|
|
def overlay_pipe_path(session)
|
|
overlay_dir(session.id).join("overlay.pipe")
|
|
end
|
|
|
|
def badge_away_color(team)
|
|
club = team.club
|
|
candidate = club&.effective_secondary_color.presence || "#1565c0"
|
|
return candidate unless light_hex_color?(candidate)
|
|
|
|
"#1565c0"
|
|
end
|
|
|
|
def light_hex_color?(hex)
|
|
h = hex.to_s.delete_prefix("#")
|
|
return false unless h.match?(/\A\h{6}\z/i)
|
|
|
|
r = h[0..1].to_i(16)
|
|
g = h[2..3].to_i(16)
|
|
b = h[4..5].to_i(16)
|
|
(0.299 * r + 0.587 * g + 0.114 * b) > 200
|
|
end
|
|
end
|
|
end
|