Initial commit
This commit is contained in:
54
app/services/video_analysis_service.rb
Normal file
54
app/services/video_analysis_service.rb
Normal file
@@ -0,0 +1,54 @@
|
||||
class VideoAnalysisService
|
||||
def presenter(video, video_analysis, audio_analysis)
|
||||
VideoAnalysisPresenter.new(
|
||||
video,
|
||||
video_analysis,
|
||||
MatchesPresenter.new(
|
||||
video,
|
||||
video_analysis,
|
||||
audio_analysis,
|
||||
all_edl_events(video),
|
||||
all_graphics_edl_events(video),
|
||||
)
|
||||
)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def all_graphics_edl_events(video)
|
||||
if video.graphics_only_edl_file.attached?
|
||||
graphics_files_for_request = GraphicsFilesForRequest.new(video, edl_timecode_start(video))
|
||||
EdlEventGateway.new(
|
||||
graphics_files_for_request,
|
||||
"00:00:00:00",
|
||||
nil,
|
||||
).edl_events
|
||||
else
|
||||
[]
|
||||
end
|
||||
end
|
||||
|
||||
def edl_timecode_start(video)
|
||||
if video.edl_timecode_start.blank?
|
||||
video.update(edl_timecode_start: start_timecode_offset(video))
|
||||
end
|
||||
|
||||
video.edl_timecode_start
|
||||
end
|
||||
|
||||
def all_edl_events(video)
|
||||
EdlEventGateway.new(
|
||||
FilesForRequest.new(video),
|
||||
"00:00:00:00",
|
||||
nil,
|
||||
).edl_events
|
||||
end
|
||||
|
||||
def start_timecode_offset(video)
|
||||
EdlEventGateway.new(
|
||||
FilesForRequest.new(video),
|
||||
"00:00:00:00",
|
||||
"00:00:00:00",
|
||||
).edl_timecode_start
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user