Files
old-holivud2/app/models/broadcast_recording.rb

22 lines
668 B
Ruby
Raw Normal View History

2020-05-31 22:38:19 +02:00
class BroadcastRecording < ApplicationRecord
belongs_to :broadcast
delegate :name, to: :broadcast, prefix: :broadcast
validates :asset_uid, uniqueness: true
2020-08-03 21:52:04 +00:00
scope :visible, -> { where(hidden: false) }
2020-05-31 22:38:19 +02:00
def download_url
"https://stream.mux.com/#{asset_playback_uid}/#{file_name}?download=#{download_file_name}"
end
def playback_url
"https://stream.mux.com/#{asset_playback_uid}/#{file_name}"
end
def download_file_name
2020-07-21 13:12:27 +00:00
"#{broadcast_name}_Date_#{created_at.in_time_zone(broadcast.shoot_location_time_zone).strftime("%Y-%m-%d")}_Time_#{created_at.in_time_zone(broadcast.shoot_location_time_zone).strftime("%T")}".parameterize
2020-05-31 22:38:19 +02:00
end
end