Hi guys,
I am building a Rails application that works with videos. I am using an encoding service that encodes my video and places the encoded file along with some thumbnails in a specified location on my s3. I am able to access the video via AWS:S3 like so:
AWS::S3::S3Object.find 'videos/36/base/video.mp4', 'my-bucket-name'
-- or --
AWS::S3::S3Object.value 'videos/36/base/video.mp4', 'my-bucket-name'
What I would like to do is manage these files with Paperclip once I get notified from my encoding service that the encoding is complete. Not sure how to do this. Here is what I have so far:
class Encoding << ActiveRecord::Base
has_attached_file :video,
:url => ':s3_domain_url',
:path => 'videos/:video_id/:encoding_type/basename.:extension',
:storage => :s3,
:s3_credentials => {:access_key_id => AppConfig.s3.access_key_id,
:secret_access_key => AppConfig.s3.secret_access_key,
:bucket => AppConfig.s3.bucket
},
:s3_permissions => 'authenticated-read',
:s3_protocol => 'http'
end
class Video << ActiveRecord::Base
def after_encoded
encoding = encodings.build
encoding.video = ## WHAT GOES HERE ??
encoding.save
end
end
Thanks! Really appreciate your help
-- jonathan