Created
June 19, 2010 19:44
-
-
Save ideaoforder/445213 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def YOUR VIDEO MODEL | |
| STUFF | |
| def zencode! | |
| # only zencode if it's not waiting to be uploaded | |
| if self.video.queued_for_write.empty? | |
| result = YOUR ZENCODER JOB | |
| if result['errors'] | |
| self.zencoder_status = "Error: #{result['errors']}" | |
| self.status = 'failed' | |
| else | |
| self.zencoder_job_id = result['id'] | |
| self.zencoder_output_id = result['outputs'][0]['id'] | |
| self.zencoder_status = 'queued' | |
| end | |
| else | |
| self.status = 'waiting' | |
| self.zencoder_status = 'queued_locally' | |
| end | |
| self.save | |
| return self.zencoder_status | |
| end | |
| end | |
| # Rake task for hitting videos that didn't hit S3 directly | |
| desc "Process Video" | |
| task :process_video => :environment do | |
| process_videos | |
| end | |
| def process_videos | |
| Video.queued_locally.each do |video| | |
| puts "[Video] processing " + video.video_file_name + " at " + Time.now.strftime("%m/%d/%y %I:%M%p") | |
| result = video.zencode! | |
| puts "[Video] status: " + result | |
| end | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment