staugaard-transcoding_machine 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,55 @@
1
+ require File.dirname(__FILE__) + '/test_helper'
2
+
3
+ class MediaFormatCriteriumTest < Test::Unit::TestCase
4
+ def test_equals_operator
5
+ criterium = TranscodingMachine::MediaFormatCriterium.new(:key => :file_name,
6
+ :operator => :equals,
7
+ :value => 'file_name')
8
+ assert(criterium.matches(:file_name => 'file_name'))
9
+ assert(!criterium.matches(:file_name => 'bad_file_name'))
10
+ end
11
+
12
+ def test_not_equals_operator
13
+ criterium = TranscodingMachine::MediaFormatCriterium.new(:key => :file_name,
14
+ :operator => :not_equals,
15
+ :value => 'bad_file_name')
16
+ assert(criterium.matches(:file_name => 'file_name'))
17
+ assert(!criterium.matches(:file_name => 'bad_file_name'))
18
+ end
19
+
20
+ def test_less_than_operator
21
+ criterium = TranscodingMachine::MediaFormatCriterium.new(:key => :bitrate,
22
+ :operator => :lt,
23
+ :value => 1000)
24
+ assert(criterium.matches(:bitrate => 500))
25
+ assert(!criterium.matches(:bitrate => 1000))
26
+ assert(!criterium.matches(:bitrate => 2000))
27
+ end
28
+
29
+ def test_less_than_or_equals operator
30
+ criterium = TranscodingMachine::MediaFormatCriterium.new(:key => :bitrate,
31
+ :operator => :lte,
32
+ :value => 1000)
33
+ assert(criterium.matches(:bitrate => 500))
34
+ assert(criterium.matches(:bitrate => 1000))
35
+ assert(!criterium.matches(:bitrate => 2000))
36
+ end
37
+
38
+ def test_greater_than_operator
39
+ criterium = TranscodingMachine::MediaFormatCriterium.new(:key => :bitrate,
40
+ :operator => :gt,
41
+ :value => 1000)
42
+ assert(!criterium.matches(:bitrate => 500))
43
+ assert(!criterium.matches(:bitrate => 1000))
44
+ assert(criterium.matches(:bitrate => 2000))
45
+ end
46
+
47
+ def test_greater_than_or_equals operator
48
+ criterium = TranscodingMachine::MediaFormatCriterium.new(:key => :bitrate,
49
+ :operator => :gte,
50
+ :value => 1000)
51
+ assert(!criterium.matches(:bitrate => 500))
52
+ assert(criterium.matches(:bitrate => 1000))
53
+ assert(criterium.matches(:bitrate => 2000))
54
+ end
55
+ end
@@ -0,0 +1,42 @@
1
+ require File.dirname(__FILE__) + '/test_helper'
2
+
3
+ class MediaFormatTest < Test::Unit::TestCase
4
+ def test_executes_criteria_matchers
5
+ media_format = TranscodingMachine::MediaFormat.new({})
6
+ media_format.criteria << TranscodingMachine::MediaFormatCriterium.new(:key => :file_name,
7
+ :operator => :equals,
8
+ :value => 'file_name')
9
+ media_format.criteria << TranscodingMachine::MediaFormatCriterium.new(:key => :bitrate,
10
+ :operator => :equals,
11
+ :value => 1000)
12
+
13
+ assert(media_format.matches(:file_name => "file_name", :bitrate => 1000))
14
+ assert(media_format.matches(:file_name => "file_name", :bitrate => 1000, :other_attribute => 'value'))
15
+ assert(!media_format.matches(:file_name => "file_name"))
16
+ assert(!media_format.matches(:bitrate => 1000))
17
+ assert(!media_format.matches(:file_name => "bad_file_name", :bitrate => 1000))
18
+ assert(!media_format.matches(:file_name => "file_name", :bitrate => 2000))
19
+ end
20
+
21
+ def test_video_format_checks_for_video
22
+ video_format = TranscodingMachine::VideoFormat.new(:width => 320, :height => 240, :aspect_ratio => (4.0/3.0))
23
+
24
+ assert(!video_format.matches({:width => 1280, :aspect_ratio => ((4.0/3.0))}))
25
+ assert(video_format.matches({:video => true, :width => 1280, :aspect_ratio => ((4.0/3.0))}))
26
+ end
27
+
28
+ def test_audio_format_checks_for_video
29
+ audio_format = TranscodingMachine::AudioFormat.new(:bitrate => 1000)
30
+
31
+ assert(audio_format.matches({:video => false, :audio => true, :bitrate => 1000}))
32
+ assert(!audio_format.matches({:video => true, :audio => true, :bitrate => 1000}))
33
+ end
34
+
35
+ def test_audio_format_checks_for_audio
36
+ audio_format = TranscodingMachine::AudioFormat.new(:bitrate => 1000)
37
+
38
+ assert(audio_format.matches({:video => false, :audio => true, :bitrate => 1000}))
39
+ assert(!audio_format.matches({:video => false, :audio => false, :bitrate => 1000}))
40
+ end
41
+
42
+ end
@@ -0,0 +1,7 @@
1
+ require File.dirname(__FILE__) + '/test_helper'
2
+
3
+ class MediaPlayerTest < Test::Unit::TestCase
4
+ def test_something
5
+
6
+ end
7
+ end
@@ -0,0 +1,9 @@
1
+ require 'rubygems'
2
+ require 'test/unit'
3
+ require 'mocha'
4
+
5
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
6
+ require 'transcoding_machine'
7
+
8
+ class Test::Unit::TestCase
9
+ end
metadata ADDED
@@ -0,0 +1,106 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: staugaard-transcoding_machine
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - Mick Staugaard
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-04-02 00:00:00 -07:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: activesupport
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 2.2.2
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: unicode
27
+ type: :runtime
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: "0.1"
34
+ version:
35
+ description: TODO
36
+ email: mick@staugaard.com
37
+ executables:
38
+ - transcoding_machine
39
+ - transcoding_machine_ec2_server
40
+ extensions: []
41
+
42
+ extra_rdoc_files:
43
+ - README
44
+ - LICENSE
45
+ files:
46
+ - NOTES.txt
47
+ - VERSION.yml
48
+ - bin/transcoding_machine
49
+ - bin/transcoding_machine_ec2_server
50
+ - lib/transcoding_machine
51
+ - lib/transcoding_machine/client
52
+ - lib/transcoding_machine/client/job_queue.rb
53
+ - lib/transcoding_machine/client/result_queue.rb
54
+ - lib/transcoding_machine/client/server_manager.rb
55
+ - lib/transcoding_machine/media_format.rb
56
+ - lib/transcoding_machine/media_format_criterium.rb
57
+ - lib/transcoding_machine/media_player.rb
58
+ - lib/transcoding_machine/server
59
+ - lib/transcoding_machine/server/ec2_environment.rb
60
+ - lib/transcoding_machine/server/file_storage.rb
61
+ - lib/transcoding_machine/server/media_file_attributes.rb
62
+ - lib/transcoding_machine/server/s3_storage.rb
63
+ - lib/transcoding_machine/server/transcoder.rb
64
+ - lib/transcoding_machine/server/transcoding_event_listener.rb
65
+ - lib/transcoding_machine/server/worker.rb
66
+ - lib/transcoding_machine/server.rb
67
+ - lib/transcoding_machine.rb
68
+ - test/deserialze_test.rb
69
+ - test/dummy_server_mananager.rb
70
+ - test/fixtures
71
+ - test/fixtures/serialized_models.json
72
+ - test/media_format_criterium_test.rb
73
+ - test/media_format_test.rb
74
+ - test/media_player_test.rb
75
+ - test/test_helper.rb
76
+ - README
77
+ - LICENSE
78
+ has_rdoc: true
79
+ homepage: http://github.com/staugaard/transcoding_machine
80
+ post_install_message:
81
+ rdoc_options:
82
+ - --inline-source
83
+ - --charset=UTF-8
84
+ require_paths:
85
+ - lib
86
+ required_ruby_version: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ version: "0"
91
+ version:
92
+ required_rubygems_version: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: "0"
97
+ version:
98
+ requirements: []
99
+
100
+ rubyforge_project:
101
+ rubygems_version: 1.2.0
102
+ signing_key:
103
+ specification_version: 2
104
+ summary: TODO
105
+ test_files: []
106
+