<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -7,115 +7,25 @@ require 'rake/rdoctask'
 require 'rake/testtask'
 require 'spec/rake/spectask'
 require 'fileutils'
-
-require File.dirname(__FILE__)+'/config/boot.rb'
-require Merb::framework_root+'/tasks'
+require 'merb-core'
+require 'rubigen'
 include FileUtils
 
-# Set these before any dependencies load
-# otherwise the ORM may connect to the wrong env
-Merb.root = File.dirname(__FILE__)
-Merb.environment = ENV['MERB_ENV'] if ENV['MERB_ENV']
-
+# Load the basic runtime dependencies; this will include 
+# any plugins and therefore plugin rake tasks.
+init_env = ENV['MERB_ENV'] || 'rake'
+Merb.load_dependencies(:environment =&gt; init_env)
+     
 # Get Merb plugins and dependencies
-require File.dirname(__FILE__)+'/config/dependencies.rb'
-Merb::Plugins.rakefiles.each {|r| require r } 
-
-#desc &quot;Packages up Merb.&quot;
-#task :default =&gt; [:package]
-
-desc &quot;load merb_init.rb&quot;
-task :merb_init do
-  # deprecated - here for BC
-  Rake::Task['merb_env'].invoke
-end
-
-task :uninstall =&gt; [:clean] do
-  sh %{sudo gem uninstall #{NAME}}
-end
-
-desc 'Run unit tests'
-Rake::TestTask.new('test_unit') do |t|
-  t.libs &lt;&lt; 'test'
-  t.pattern = 'test/unit/*_test.rb'
-  t.verbose = true
-end
-
-desc 'Run functional tests'
-Rake::TestTask.new('test_functional') do |t|
-  t.libs &lt;&lt; 'test'
-  t.pattern = 'test/functional/*_test.rb'
-  t.verbose = true
-end
-
-desc 'Run all tests'
-Rake::TestTask.new('test') do |t|
-  t.libs &lt;&lt; 'test'
-  t.pattern = 'test/**/*_test.rb'
-  t.verbose = true
-end
-
-desc &quot;Run all specs&quot;
-Spec::Rake::SpecTask.new('specs') do |t|
-  t.spec_opts = [&quot;--format&quot;, &quot;specdoc&quot;, &quot;--colour&quot;]
-  t.spec_files = Dir['spec/**/*_spec.rb'].sort
-end
-
-desc &quot;Run all model specs&quot;
-Spec::Rake::SpecTask.new('model_specs') do |t|
-  t.spec_opts = [&quot;--format&quot;, &quot;specdoc&quot;, &quot;--colour&quot;]
-  t.spec_files = Dir['spec/models/**/*_spec.rb'].sort
-end
-
-desc &quot;Run all controller specs&quot;
-Spec::Rake::SpecTask.new('controller_specs') do |t|
-  t.spec_opts = [&quot;--format&quot;, &quot;specdoc&quot;, &quot;--colour&quot;]
-  t.spec_files = Dir['spec/controllers/**/*_spec.rb'].sort
-end
-
-desc &quot;Run a specific spec with TASK=xxxx&quot;
-Spec::Rake::SpecTask.new('spec') do |t|
-  t.spec_opts = [&quot;--format&quot;, &quot;specdoc&quot;, &quot;--colour&quot;]
-  t.libs = ['lib', 'server/lib' ]
-  t.spec_files = [&quot;spec/merb/#{ENV['TASK']}_spec.rb&quot;]
-end
-
-desc &quot;Run all specs output html&quot;
-Spec::Rake::SpecTask.new('specs_html') do |t|
-  t.spec_opts = [&quot;--format&quot;, &quot;html&quot;]
-  t.libs = ['lib', 'server/lib' ]
-  t.spec_files = Dir['spec/**/*_spec.rb'].sort
-end
-
-desc &quot;RCov&quot;
-Spec::Rake::SpecTask.new('rcov') do |t|
-  t.spec_opts = [&quot;--format&quot;, &quot;specdoc&quot;, &quot;--colour&quot;]
-  t.spec_files = Dir['spec/**/*_spec.rb'].sort
-  t.libs = ['lib', 'server/lib' ]
-  t.rcov = true
-end
-
-desc 'Run all tests, specs and finish with rcov'
-task :aok do
-  sh %{rake rcov}
-  sh %{rake spec}
-end
+Merb::Plugins.rakefiles.each { |r| require r } 
 
-unless Gem.cache.search(&quot;haml&quot;).empty?
-  namespace :haml do
-    desc &quot;Compiles all sass files into CSS&quot;
-    task :compile_sass do
-      gem 'haml'
-      require 'sass'
-      puts &quot;*** Updating stylesheets&quot;
-      Sass::Plugin.update_stylesheets
-      puts &quot;*** Done&quot;      
-    end
-  end
+desc &quot;start runner environment&quot;
+task :merb_env do
+  Merb.start_environment(:environment =&gt; init_env, :adapter =&gt; 'runner')
 end
 
 ##############################################################################
-# SVN
+# ADD YOUR CUSTOM TASKS BELOW
 ##############################################################################
 
 desc &quot;Add new files to subversion&quot;</diff>
      <filename>Rakefile</filename>
    </modified>
    <modified>
      <diff>@@ -135,16 +135,16 @@ class Video &lt; SimpleDB::Base
       cur_video = Video.query(&quot;['parent' = '#{self.key}'] intersection ['profile' = '#{p.key}']&quot;)
       unless cur_video
         # TODO: move to a method like self.add_encoding
-        video = Video.new
-        video[:profile] = p.key
-        video[:profile_title] = p.title
-        video[:status] = 'queued'
-        video[:parent] = self.key
+        encoding = Video.new
+        encoding[:profile] = p.key
+        encoding[:profile_title] = p.title
+        encoding[:status] = 'queued'
+        encoding[:parent] = self.key
         [:original_filename, :duration, :container, :width, :height, :video_codec, :video_bitrate, :fps, :audio_codec, :audio_bitrate, :audio_sample_rate].each do |k|
-          video.put(k, p.get(k))
+          encoding.put(k, p.get(k))
         end
-        video[:filename] = &quot;#{self.key}.#{video.container}&quot;
-        video.save
+        encoding[:filename] = &quot;#{encoding.key}.#{p.container}&quot;
+        encoding.save
       end
     end
     </diff>
      <filename>app/models/video.rb</filename>
    </modified>
    <modified>
      <diff>@@ -114,7 +114,7 @@ def encoding(key,log)
     
     log.info recipe_options.to_yaml
     
-    begin
+    # begin
       case encoding.container
       when &quot;flv&quot;
         recipe = &quot;ffmpeg -i $input_file$ -ar 22050 -ab $audio_bitrate$k -f flv -b $video_bitrate_in_bits$ -r 22 $resolution_and_padding$ -y $output_file$&quot;
@@ -157,43 +157,43 @@ def encoding(key,log)
         log.info Time.now
       else
         log.warn &quot;Error: unknown encoding format given&quot;
-        Rog.log :error, &quot;job##{job[:id]}: Couldn't encode #{encoding[:id]}. Unknown encoding format given.&quot;
+        Rog.log :error, &quot;Couldn't encode #{encoding.key}. Unknown encoding format given.&quot;
       end
       
       log.info &quot;Done encoding&quot;
       
       # Now upload it to S3
       if File.exists?(enc_fn)
-        Rog.log :info, &quot;job##{job[:id]}: Success encoding #{encoding.filename}. Uploading to S3.&quot;
+        Rog.log :info, &quot;Success encoding #{encoding.filename}. Uploading to S3.&quot;
         log.info &quot;Uploading #{encoding.filename}&quot;
+        
         encoding.upload_to_s3
         FileUtils.rm encoding.tmp_filepath
+        
         log.info &quot;Done uploading&quot;
         
         # Update the encoding data which will be returned to the server
-        encoding[:status] = &quot;success&quot;
+        encoding.status = &quot;success&quot;
       else
-        encoding[:status] = &quot;error&quot;
-        Rog.log :info, &quot;job##{job[:id]}: Couldn't upload #{encoding[:id]} to S3. To file #{enc_fn} doesn't exist.&quot;
+        encoding.status = &quot;error&quot;
+        Rog.log :info, &quot;Couldn't upload #{encoding.key]} to S3 as #{enc_fn} doesn't exist.&quot;
         log.warn &quot;Error: Cannot upload as #{enc_fn} does not exist&quot;
       end
       
-      # Seems like it was a success
-      encoding[:status] = &quot;success&quot;
-      encoding[:executed_commands] = transcoder.executed_commands
-    rescue RVideo::TranscoderError =&gt; e
-      encoding[:status] = &quot;error&quot;
-      encoding[:executed_commands] = transcoder.executed_commands
-      Rog.log :error, &quot;job##{job[:id]}: Error transcoding #{encoding[:id]}: #{e.class} - #{e.message}&quot;
-      log.info &quot;Unable to transcode file #{encoding[:id]}: #{e.class} - #{e.message}&quot;
-    end
+      # encoding[:executed_commands] = transcoder.executed_commands
+    # rescue RVideo::TranscoderError =&gt; e
+    #   encoding.status = &quot;error&quot;
+    #   # encoding[:executed_commands] = transcoder.executed_commands
+    #   Rog.log :error, &quot;Error transcoding #{encoding[:id]}: #{e.class} - #{e.message}&quot;
+    #   log.info &quot;Unable to transcode file #{encoding[:id]}: #{e.class} - #{e.message}&quot;
+    # end
   end
   
   log.info &quot;All encodings complete!&quot;
-  Rog.log :info, &quot;job##{job[:id]}: Complete!&quot;
+  Rog.log :info, &quot;Complete!&quot;
   FileUtils.rm raw_fn
-  job[:encoding_time] = Time.now - begun_encoding
-  return job
+  encoding.encoding_time = Time.now - begun_encoding
+  return true
 end
 
 loop do</diff>
      <filename>lib/encoder.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>36b7e628d96f3f027d8d68fe80c913ce79f85521</id>
    </parent>
  </parents>
  <author>
    <name>Damien Tanner</name>
    <email>damien@new-bamboo.co.uk</email>
  </author>
  <url>http://github.com/reddavis/panda/commit/595bfb6a3b89dd35f86a66a8a4aabf30b12635a0</url>
  <id>595bfb6a3b89dd35f86a66a8a4aabf30b12635a0</id>
  <committed-date>2008-06-11T15:06:21-07:00</committed-date>
  <authored-date>2008-06-11T15:06:21-07:00</authored-date>
  <message>encoder could work now, but needs intense refactoring</message>
  <tree>542066f73b6f95088ae95c7afd1d7f929a500017</tree>
  <committer>
    <name>Damien Tanner</name>
    <email>damien@new-bamboo.co.uk</email>
  </committer>
</commit>
