Much base work started
Some checks failed
CI / scan_ruby (push) Has been cancelled
CI / scan_js (push) Has been cancelled
CI / lint (push) Has been cancelled
CI / test (push) Has been cancelled
CI / system-test (push) Has been cancelled

This commit is contained in:
Dan Milne
2025-10-31 14:36:14 +11:00
parent 4a35bf6758
commit 88a906064f
97 changed files with 5333 additions and 2774 deletions

View 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

View File

@@ -0,0 +1,11 @@
module Searchable
extend ActiveSupport::Concern
class_methods do
def search(query)
return all if query.blank?
where("title LIKE ?", "%#{sanitize_sql_like(query)}%")
end
end
end

View File

@@ -0,0 +1,19 @@
module Streamable
extend ActiveSupport::Concern
def stream_url
storage_location.adapter.stream_url(self)
end
def streamable?
duration.present? && storage_location.enabled? && storage_location.adapter.readable?
end
def stream_type
case source_type
when "s3" then :presigned
when "local" then :direct
else :proxy
end
end
end