App: scelta canale YouTube MLTV/società, privacy e condivisione link.
Premium Full può forzare il canale piattaforma; visibilità non in elenco o privato; share_url unificato per Match Live TV e YouTube. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -24,7 +24,9 @@ module Sessions
|
||||
)
|
||||
|
||||
if session.platform == "youtube"
|
||||
attach_youtube_broadcast!(session)
|
||||
youtube_channel = @params[:youtube_channel].presence
|
||||
assert_youtube_channel!(youtube_channel)
|
||||
attach_youtube_broadcast!(session, youtube_channel: youtube_channel)
|
||||
end
|
||||
|
||||
StreamSession.transaction do
|
||||
@@ -39,8 +41,18 @@ module Sessions
|
||||
|
||||
private
|
||||
|
||||
def attach_youtube_broadcast!(session)
|
||||
yt = Youtube::BroadcastService.new(session.match.team)
|
||||
def assert_youtube_channel!(youtube_channel)
|
||||
resolver = Youtube::CredentialResolver.new(@match.team, channel: youtube_channel)
|
||||
if resolver.resolve.blank?
|
||||
raise Teams::EntitlementError.new(
|
||||
"Canale YouTube selezionato non disponibile",
|
||||
code: "youtube_channel_unavailable"
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
def attach_youtube_broadcast!(session, youtube_channel: nil)
|
||||
yt = Youtube::BroadcastService.new(session.match.team, youtube_channel: youtube_channel)
|
||||
title = "#{session.match.team.name} vs #{session.match.opponent_name}"
|
||||
broadcast = yt.create_broadcast!(
|
||||
title: title,
|
||||
|
||||
Reference in New Issue
Block a user