zencoder 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -5,4 +5,9 @@
5
5
  * Birthday!
6
6
 
7
7
  === 1.0.1 / 2010-04-29
8
+
8
9
  * Updated readme
10
+
11
+ === 1.0.2 / 2010-04-29
12
+
13
+ * Fixed manifest
data/Manifest.txt CHANGED
@@ -1,8 +1,7 @@
1
- .autotest
2
1
  History.txt
3
2
  Manifest.txt
4
3
  README.txt
5
4
  Rakefile
6
- bin/zencoder
5
+ lib/recipes.rb
7
6
  lib/zencoder.rb
8
7
  test/test_zencoder.rb
data/lib/recipes.rb ADDED
@@ -0,0 +1,74 @@
1
+
2
+ module ZencoderAPI #:nodoc:
3
+
4
+
5
+ # This class implements a couple of bogus recipes, mainly as an example of usage. Recipe isntances can be passed in to Zencoder#submit_job
6
+ class Recipe
7
+ @@keys = [:label, :base_url, :filename, :width, :height, :quality, :speed,
8
+ :upscale, :stretch, :frame_rate, :max_frame_rate, :keyframe_interval,
9
+ :video_bitrate, :bitrate_cap, :buffer_size, :h264_profile, :h264_level,
10
+ :skip_video, :audio_codec, :audio_bitrate, :audio_channels, :audio_sample_rate,
11
+ :skip_audio, :start_clip, :clip_length, :thumbnails, :notifications]
12
+
13
+ @@thumb_keys = [:number, :size, :base_url, :prefix]
14
+
15
+ # constructor. accepts a name for the recipe, and a hash of params. The constructor will try to verify that you aren't doing
16
+ # something it doesn't know about, though does no further validation.
17
+ def initialize(name, params )
18
+ params = params.inject(Hash.new) do |m,v|
19
+ m[v.first.to_s.to_sym]=v.last
20
+ m
21
+ end
22
+ raise RecipeError.new("no recipe parameters?") if params.empty?
23
+ raise RecipeError.new("unknown recipe parameter #{params.keys - @@keys}") unless (params.keys - @@keys).empty?
24
+ if params[:thumbnails]
25
+ raise RecipeError.new("unknown thumb keys #{params[:thumbnails].keys - @@thumb_keys}") if (params[:thumbnails].keys - @@thumb_keys).empty?
26
+ end
27
+ @o = params
28
+ end
29
+
30
+
31
+ def to_json #:nodoc:
32
+ @o.to_json
33
+ end
34
+ end
35
+
36
+ # Raised if something goes wrong with a recipe configuration
37
+ class RecipeError < Exception; end
38
+
39
+ # Some example recipes.
40
+ module Recipes
41
+ #A sample iphone recipe. if you have a better one, send me a patch.
42
+ def self.iphone(params={})
43
+ raise "Base_url unset." unless params['base_url']
44
+ defaults = {
45
+ "label"=> "iphone",
46
+ "width"=> 240,
47
+ "frame_rate"=> 24,
48
+ "max_frame_rate"=> 24,
49
+ "video_bitrate"=> 40,
50
+ "bitrate_cap"=> 100
51
+ }
52
+
53
+ params = defaults.merge(params)
54
+
55
+ Recipe.new(:iphone, params)
56
+ end
57
+
58
+ # A sample web recipe. if you have a better one, send me a patch.
59
+ def self.web(params={})
60
+ raise "Base_url unset." unless params['base_url']
61
+ defaults = {
62
+ "label"=> "web",
63
+ "width"=> 240,
64
+ "frame_rate"=> 24,
65
+ "max_frame_rate"=> 24,
66
+ "video_bitrate"=> 40,
67
+ "bitrate_cap"=> 100
68
+ }
69
+ params = defaults.merge(params)
70
+
71
+ Recipe.new(:web, params)
72
+ end
73
+ end
74
+ end
data/lib/zencoder.rb CHANGED
@@ -13,7 +13,7 @@ class Zencoder
13
13
  # Currently https://app.zencoder.com/api This means you have to have ssl built into your ruby!
14
14
  API_URL = 'https://app.zencoder.com/api'
15
15
 
16
- VERSION = '1.0.1' #:nodoc:
16
+ VERSION = '1.0.2' #:nodoc:
17
17
  # Submits a job to zencoder.
18
18
  # The recipe should be an instance or array of instances of ZencoderAPI::Recipe
19
19
  # Exceptions are not handled, but rather propagated upwards.
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 0
8
- - 1
9
- version: 1.0.1
8
+ - 2
9
+ version: 1.0.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - McClain Looney
@@ -79,8 +79,8 @@ description: |-
79
79
  See http://www.Zencoder.com for more details.
80
80
  email:
81
81
  - m@loonsoft.com
82
- executables:
83
- - zencoder
82
+ executables: []
83
+
84
84
  extensions: []
85
85
 
86
86
  extra_rdoc_files:
@@ -88,12 +88,11 @@ extra_rdoc_files:
88
88
  - Manifest.txt
89
89
  - README.txt
90
90
  files:
91
- - .autotest
92
91
  - History.txt
93
92
  - Manifest.txt
94
93
  - README.txt
95
94
  - Rakefile
96
- - bin/zencoder
95
+ - lib/recipes.rb
97
96
  - lib/zencoder.rb
98
97
  - test/test_zencoder.rb
99
98
  has_rdoc: true
data/.autotest DELETED
@@ -1,23 +0,0 @@
1
- # -*- ruby -*-
2
-
3
- require 'autotest/restart'
4
-
5
- # Autotest.add_hook :initialize do |at|
6
- # at.extra_files << "../some/external/dependency.rb"
7
- #
8
- # at.libs << ":../some/external"
9
- #
10
- # at.add_exception 'vendor'
11
- #
12
- # at.add_mapping(/dependency.rb/) do |f, _|
13
- # at.files_matching(/test_.*rb$/)
14
- # end
15
- #
16
- # %w(TestA TestB).each do |klass|
17
- # at.extra_class_map[klass] = "test/test_misc.rb"
18
- # end
19
- # end
20
-
21
- # Autotest.add_hook :run_command do |at|
22
- # system "rake build"
23
- # end
data/bin/zencoder DELETED
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- abort "you need to write me"