Much base work started
This commit is contained in:
26
app/models/concerns/processable.rb
Normal file
26
app/models/concerns/processable.rb
Normal file
@@ -0,0 +1,26 @@
|
||||
module Processable
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
included do
|
||||
scope :processing_pending, -> { where("video_metadata->>'duration' IS NULL") }
|
||||
end
|
||||
|
||||
def processed?
|
||||
duration.present?
|
||||
end
|
||||
|
||||
def processing_pending?
|
||||
!processed? && processing_errors.blank?
|
||||
end
|
||||
|
||||
def mark_processing_failed!(error_message)
|
||||
self.processing_errors = [error_message]
|
||||
save!
|
||||
end
|
||||
|
||||
def retry_processing!
|
||||
self.processing_errors = []
|
||||
save!
|
||||
# VideoProcessorJob.perform_later(id) - will be implemented later
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user