Aggiunge modulo Replay, Garage dev e YouTube a livello società.
Pipeline registrazione/upload con storage S3, archivio web e app, proxy replay per il browser, OAuth YouTube sulla pagina club (Premium Full) e footer legale. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
18
backend/app/jobs/recordings/expiry_warning_job.rb
Normal file
18
backend/app/jobs/recordings/expiry_warning_job.rb
Normal file
@@ -0,0 +1,18 @@
|
||||
module Recordings
|
||||
class ExpiryWarningJob
|
||||
include Sidekiq::Job
|
||||
sidekiq_options retry: 1, queue: "default"
|
||||
|
||||
def perform
|
||||
Recording.ready
|
||||
.where(expiry_warning_sent_at: nil)
|
||||
.where.not(expires_at: nil)
|
||||
.where(expires_at: ..7.days.from_now)
|
||||
.find_each do |recording|
|
||||
Recordings::NotifyExpiring.new(recording).call
|
||||
rescue StandardError => e
|
||||
Rails.logger.warn("[Recordings::ExpiryWarningJob] #{recording.id}: #{e.message}")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
18
backend/app/jobs/recordings/post_process_job.rb
Normal file
18
backend/app/jobs/recordings/post_process_job.rb
Normal file
@@ -0,0 +1,18 @@
|
||||
module Recordings
|
||||
class PostProcessJob
|
||||
include Sidekiq::Job
|
||||
sidekiq_options retry: 2, queue: "default"
|
||||
|
||||
def perform(recording_id)
|
||||
recording = Recording.find_by(id: recording_id)
|
||||
return unless recording&.ready?
|
||||
|
||||
Recordings::NotifyReady.new(recording).call
|
||||
|
||||
return unless recording.auto_publish_youtube?
|
||||
return if recording.youtube_video_id.present?
|
||||
|
||||
Recordings::PublishToYoutubeJob.perform_async(recording.id)
|
||||
end
|
||||
end
|
||||
end
|
||||
17
backend/app/jobs/recordings/publish_to_youtube_job.rb
Normal file
17
backend/app/jobs/recordings/publish_to_youtube_job.rb
Normal file
@@ -0,0 +1,17 @@
|
||||
module Recordings
|
||||
class PublishToYoutubeJob
|
||||
include Sidekiq::Job
|
||||
sidekiq_options retry: 2, queue: "default"
|
||||
|
||||
def perform(recording_id)
|
||||
recording = Recording.find_by(id: recording_id)
|
||||
return unless recording&.ready?
|
||||
|
||||
Recordings::PublishToYoutube.new(recording).call
|
||||
rescue Recordings::PublishToYoutube::Error => e
|
||||
meta = recording.metadata.merge("youtube_publish_error" => e.message, "youtube_publish_failed_at" => Time.current.iso8601)
|
||||
recording.update!(metadata: meta)
|
||||
Rails.logger.warn("[Recordings::PublishToYoutubeJob] #{recording_id}: #{e.message}")
|
||||
end
|
||||
end
|
||||
end
|
||||
14
backend/app/jobs/recordings/purge_expired_job.rb
Normal file
14
backend/app/jobs/recordings/purge_expired_job.rb
Normal file
@@ -0,0 +1,14 @@
|
||||
module Recordings
|
||||
class PurgeExpiredJob
|
||||
include Sidekiq::Job
|
||||
sidekiq_options retry: 1, queue: "default"
|
||||
|
||||
def perform
|
||||
Recording.expired_pending_purge.find_each do |recording|
|
||||
Recordings::Delete.new(recording, reason: :expired).call
|
||||
rescue StandardError => e
|
||||
Rails.logger.warn("[Recordings::PurgeExpiredJob] #{recording.id}: #{e.message}")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
14
backend/app/jobs/recordings/upload_job.rb
Normal file
14
backend/app/jobs/recordings/upload_job.rb
Normal file
@@ -0,0 +1,14 @@
|
||||
module Recordings
|
||||
class UploadJob
|
||||
include Sidekiq::Job
|
||||
sidekiq_options retry: 3, queue: "default"
|
||||
|
||||
def perform(session_id)
|
||||
session = StreamSession.find_by(id: session_id)
|
||||
return unless session
|
||||
|
||||
Recordings::UploadFromSession.new(session).call
|
||||
Recordings::PurgeExpiredJob.perform_async
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user