Initial commit
This commit is contained in:
45
app/models/video_analysis.rb
Normal file
45
app/models/video_analysis.rb
Normal file
@@ -0,0 +1,45 @@
|
||||
class VideoAnalysis
|
||||
mattr_accessor :use_overlay_video, default: true
|
||||
|
||||
def initialize(video, reanalysis)
|
||||
@video = video
|
||||
@reanalysis = reanalysis
|
||||
end
|
||||
|
||||
# Use the custom hash to generate JSON format
|
||||
def as_json(*)
|
||||
to_hash
|
||||
end
|
||||
|
||||
def to_hash
|
||||
{
|
||||
bucket_name: aws_bucket_name,
|
||||
collection_id: video.project.headshot_collection_uid,
|
||||
video_object_name: video.file.key,
|
||||
reanalysis: reanalysis,
|
||||
}
|
||||
end
|
||||
|
||||
def overlay_video_url
|
||||
return if !use_overlay_video
|
||||
return if response.overlay_video_url == "None"
|
||||
|
||||
response.overlay_video_url
|
||||
end
|
||||
|
||||
def first_appearances
|
||||
response.first_appearances
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
attr_reader :video, :reanalysis
|
||||
|
||||
def aws_bucket_name
|
||||
ENV["AWS_BUCKET"]
|
||||
end
|
||||
|
||||
def response
|
||||
@response ||= BrayniacAI::FacialRecognition.find(video.analysis_uid)
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user