Files
eminuxandCursor baa6283a15 Mantiene la copertina YouTube se il telefono cade e avvia ffmpeg sul nodo, non via SSH.
Il relay HLS→RTMPS resta sul worker/agent del nodo assegnato, così tre dirette contemporanee restano in onda sul sito e sul canale della società senza schermo nero.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-16 20:41:46 +02:00

53 lines
1.2 KiB
Ruby

module Youtube
class TeamStatus
PLATFORM_LABEL = "Match Live TV".freeze
def initialize(team)
@team = team
@ent = team.entitlements
@mode = @ent.plan.youtube_mode
end
def selectable?
return false unless @ent.youtube_enabled?
case @mode
when "matchlivetv_light"
PlatformCredential.configured?
when "team"
@team.club.youtube_credential&.usable? || PlatformCredential.configured?
else
false
end
end
def connected?
selectable?
end
def uses_platform_channel?
return false unless @ent.youtube_enabled?
if @mode == "matchlivetv_light"
PlatformCredential.configured?
elsif @mode == "team"
!@team.club.youtube_credential&.usable? && PlatformCredential.configured?
else
false
end
end
def channel_title
if uses_platform_channel?
PLATFORM_LABEL
else
@team.club.youtube_credential&.channel_title
end
end
def needs_team_oauth?
@mode == "team" && @ent.premium_full? && !@team.club.youtube_credential&.usable? && !PlatformCredential.configured?
end
end
end