vidibus-recording 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/vidibus/recording/backend.rb +2 -2
- data/lib/vidibus/recording/job.rb +1 -1
- data/lib/vidibus/recording/version.rb +1 -1
- data/lib/vidibus/recording.rb +4 -4
- data/lib/vidibus-recording.rb +6 -7
- metadata +87 -62
- data/.gitignore +0 -5
- data/Gemfile +0 -6
- data/Gemfile.lock +0 -75
- data/spec/log/v22.log +0 -29
- data/spec/log/v23.log +0 -30
- data/spec/spec_helper.rb +0 -38
- data/spec/vidibus/recording/backend/rtmpdump_spec.rb +0 -53
- data/spec/vidibus/recording/backend_spec.rb +0 -29
- data/spec/vidibus/recording/mongoid_spec.rb +0 -111
- data/vidibus-recording.gemspec +0 -30
@@ -3,8 +3,8 @@ module Vidibus::Recording
|
|
3
3
|
class ConfigurationError < StandardError; end
|
4
4
|
class ProtocolError < ConfigurationError; end
|
5
5
|
|
6
|
-
BACKENDS = %[rtmpdump]
|
7
|
-
|
6
|
+
BACKENDS = %w[rtmpdump]
|
7
|
+
|
8
8
|
# Returns an instance of a backend processor
|
9
9
|
# that is able to record the given stream.
|
10
10
|
def self.load(attributes)
|
data/lib/vidibus/recording.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
4
|
-
require
|
1
|
+
require 'vidibus/recording/job'
|
2
|
+
require 'vidibus/recording/backend'
|
3
|
+
require 'vidibus/recording/helpers'
|
4
|
+
require 'vidibus/recording/mongoid'
|
data/lib/vidibus-recording.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
1
|
+
require 'open3'
|
2
|
+
require 'yaml'
|
3
|
+
require 'delayed_job_mongoid'
|
4
|
+
require 'active_support/core_ext'
|
5
|
+
require 'vidibus-uuid'
|
6
6
|
|
7
7
|
module Vidibus
|
8
8
|
module Recording
|
@@ -12,5 +12,4 @@ module Vidibus
|
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
|
-
|
16
|
-
require "recording"
|
15
|
+
require 'vidibus/recording'
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vidibus-recording
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 19
|
5
|
+
prerelease:
|
5
6
|
segments:
|
6
7
|
- 0
|
7
8
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
9
|
+
- 6
|
10
|
+
version: 0.0.6
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Andre Pankratz
|
@@ -14,119 +15,150 @@ autorequire:
|
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
16
17
|
|
17
|
-
date:
|
18
|
-
default_executable:
|
18
|
+
date: 2013-04-14 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
|
-
|
22
|
-
|
23
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
21
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
22
|
+
none: false
|
24
23
|
requirements:
|
25
24
|
- - ~>
|
26
25
|
- !ruby/object:Gem::Version
|
26
|
+
hash: 5
|
27
27
|
segments:
|
28
28
|
- 3
|
29
29
|
version: "3"
|
30
30
|
type: :runtime
|
31
|
-
|
32
|
-
- !ruby/object:Gem::Dependency
|
33
|
-
name: mongoid
|
31
|
+
requirement: *id001
|
34
32
|
prerelease: false
|
35
|
-
|
33
|
+
name: activesupport
|
34
|
+
- !ruby/object:Gem::Dependency
|
35
|
+
version_requirements: &id002 !ruby/object:Gem::Requirement
|
36
|
+
none: false
|
36
37
|
requirements:
|
37
38
|
- - ~>
|
38
39
|
- !ruby/object:Gem::Version
|
40
|
+
hash: 7
|
39
41
|
segments:
|
40
42
|
- 2
|
41
43
|
version: "2"
|
42
44
|
type: :runtime
|
43
|
-
|
44
|
-
- !ruby/object:Gem::Dependency
|
45
|
-
name: delayed_job_mongoid
|
45
|
+
requirement: *id002
|
46
46
|
prerelease: false
|
47
|
-
|
47
|
+
name: mongoid
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
version_requirements: &id003 !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
48
51
|
requirements:
|
49
52
|
- - ">="
|
50
53
|
- !ruby/object:Gem::Version
|
54
|
+
hash: 3
|
51
55
|
segments:
|
52
56
|
- 0
|
53
57
|
version: "0"
|
54
58
|
type: :runtime
|
55
|
-
|
56
|
-
- !ruby/object:Gem::Dependency
|
57
|
-
name: vidibus-uuid
|
59
|
+
requirement: *id003
|
58
60
|
prerelease: false
|
59
|
-
|
61
|
+
name: delayed_job_mongoid
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
version_requirements: &id004 !ruby/object:Gem::Requirement
|
64
|
+
none: false
|
60
65
|
requirements:
|
61
66
|
- - ">="
|
62
67
|
- !ruby/object:Gem::Version
|
68
|
+
hash: 3
|
63
69
|
segments:
|
64
70
|
- 0
|
65
71
|
version: "0"
|
66
72
|
type: :runtime
|
67
|
-
|
68
|
-
- !ruby/object:Gem::Dependency
|
69
|
-
name: bundler
|
73
|
+
requirement: *id004
|
70
74
|
prerelease: false
|
71
|
-
|
75
|
+
name: vidibus-uuid
|
76
|
+
- !ruby/object:Gem::Dependency
|
77
|
+
version_requirements: &id005 !ruby/object:Gem::Requirement
|
78
|
+
none: false
|
72
79
|
requirements:
|
73
80
|
- - ">="
|
74
81
|
- !ruby/object:Gem::Version
|
82
|
+
hash: 23
|
75
83
|
segments:
|
76
84
|
- 1
|
77
85
|
- 0
|
78
86
|
- 0
|
79
87
|
version: 1.0.0
|
80
88
|
type: :development
|
81
|
-
|
82
|
-
- !ruby/object:Gem::Dependency
|
83
|
-
name: rake
|
89
|
+
requirement: *id005
|
84
90
|
prerelease: false
|
85
|
-
|
91
|
+
name: bundler
|
92
|
+
- !ruby/object:Gem::Dependency
|
93
|
+
version_requirements: &id006 !ruby/object:Gem::Requirement
|
94
|
+
none: false
|
86
95
|
requirements:
|
87
96
|
- - ">="
|
88
97
|
- !ruby/object:Gem::Version
|
98
|
+
hash: 3
|
89
99
|
segments:
|
90
100
|
- 0
|
91
101
|
version: "0"
|
92
102
|
type: :development
|
93
|
-
|
94
|
-
- !ruby/object:Gem::Dependency
|
95
|
-
name: rspec
|
103
|
+
requirement: *id006
|
96
104
|
prerelease: false
|
97
|
-
|
105
|
+
name: rake
|
106
|
+
- !ruby/object:Gem::Dependency
|
107
|
+
version_requirements: &id007 !ruby/object:Gem::Requirement
|
108
|
+
none: false
|
98
109
|
requirements:
|
99
|
-
- -
|
110
|
+
- - ">="
|
100
111
|
- !ruby/object:Gem::Version
|
112
|
+
hash: 3
|
101
113
|
segments:
|
102
|
-
-
|
103
|
-
version: "
|
114
|
+
- 0
|
115
|
+
version: "0"
|
104
116
|
type: :development
|
105
|
-
|
106
|
-
- !ruby/object:Gem::Dependency
|
107
|
-
name: rr
|
117
|
+
requirement: *id007
|
108
118
|
prerelease: false
|
109
|
-
|
119
|
+
name: rdoc
|
120
|
+
- !ruby/object:Gem::Dependency
|
121
|
+
version_requirements: &id008 !ruby/object:Gem::Requirement
|
122
|
+
none: false
|
110
123
|
requirements:
|
111
124
|
- - ">="
|
112
125
|
- !ruby/object:Gem::Version
|
126
|
+
hash: 3
|
113
127
|
segments:
|
114
128
|
- 0
|
115
129
|
version: "0"
|
116
130
|
type: :development
|
117
|
-
|
118
|
-
|
131
|
+
requirement: *id008
|
132
|
+
prerelease: false
|
119
133
|
name: rcov
|
134
|
+
- !ruby/object:Gem::Dependency
|
135
|
+
version_requirements: &id009 !ruby/object:Gem::Requirement
|
136
|
+
none: false
|
137
|
+
requirements:
|
138
|
+
- - ~>
|
139
|
+
- !ruby/object:Gem::Version
|
140
|
+
hash: 7
|
141
|
+
segments:
|
142
|
+
- 2
|
143
|
+
version: "2"
|
144
|
+
type: :development
|
145
|
+
requirement: *id009
|
120
146
|
prerelease: false
|
121
|
-
|
147
|
+
name: rspec
|
148
|
+
- !ruby/object:Gem::Dependency
|
149
|
+
version_requirements: &id010 !ruby/object:Gem::Requirement
|
150
|
+
none: false
|
122
151
|
requirements:
|
123
152
|
- - ">="
|
124
153
|
- !ruby/object:Gem::Version
|
154
|
+
hash: 3
|
125
155
|
segments:
|
126
156
|
- 0
|
127
157
|
version: "0"
|
128
158
|
type: :development
|
129
|
-
|
159
|
+
requirement: *id010
|
160
|
+
prerelease: false
|
161
|
+
name: rr
|
130
162
|
description: Allows recording of RTMP video streams. Uses RTMPdump.
|
131
163
|
email: andre@vidibus.com
|
132
164
|
executables: []
|
@@ -136,29 +168,18 @@ extensions: []
|
|
136
168
|
extra_rdoc_files: []
|
137
169
|
|
138
170
|
files:
|
139
|
-
- .gitignore
|
140
|
-
- Gemfile
|
141
|
-
- Gemfile.lock
|
142
|
-
- LICENSE
|
143
|
-
- README.rdoc
|
144
|
-
- Rakefile
|
145
|
-
- app/models/recording.rb
|
146
|
-
- lib/vidibus-recording.rb
|
147
|
-
- lib/vidibus/recording.rb
|
148
|
-
- lib/vidibus/recording/backend.rb
|
149
171
|
- lib/vidibus/recording/backend/rtmpdump.rb
|
172
|
+
- lib/vidibus/recording/backend.rb
|
150
173
|
- lib/vidibus/recording/helpers.rb
|
151
174
|
- lib/vidibus/recording/job.rb
|
152
175
|
- lib/vidibus/recording/mongoid.rb
|
153
176
|
- lib/vidibus/recording/version.rb
|
154
|
-
-
|
155
|
-
-
|
156
|
-
-
|
157
|
-
-
|
158
|
-
-
|
159
|
-
-
|
160
|
-
- vidibus-recording.gemspec
|
161
|
-
has_rdoc: true
|
177
|
+
- lib/vidibus/recording.rb
|
178
|
+
- lib/vidibus-recording.rb
|
179
|
+
- app/models/recording.rb
|
180
|
+
- LICENSE
|
181
|
+
- README.rdoc
|
182
|
+
- Rakefile
|
162
183
|
homepage: https://github.com/vidibus/vidibus-recording
|
163
184
|
licenses: []
|
164
185
|
|
@@ -168,16 +189,20 @@ rdoc_options: []
|
|
168
189
|
require_paths:
|
169
190
|
- lib
|
170
191
|
required_ruby_version: !ruby/object:Gem::Requirement
|
192
|
+
none: false
|
171
193
|
requirements:
|
172
194
|
- - ">="
|
173
195
|
- !ruby/object:Gem::Version
|
196
|
+
hash: 3
|
174
197
|
segments:
|
175
198
|
- 0
|
176
199
|
version: "0"
|
177
200
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
201
|
+
none: false
|
178
202
|
requirements:
|
179
203
|
- - ">="
|
180
204
|
- !ruby/object:Gem::Version
|
205
|
+
hash: 23
|
181
206
|
segments:
|
182
207
|
- 1
|
183
208
|
- 3
|
@@ -186,7 +211,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
186
211
|
requirements: []
|
187
212
|
|
188
213
|
rubyforge_project:
|
189
|
-
rubygems_version: 1.
|
214
|
+
rubygems_version: 1.8.24
|
190
215
|
signing_key:
|
191
216
|
specification_version: 3
|
192
217
|
summary: Video stream recording tools
|
data/Gemfile
DELETED
data/Gemfile.lock
DELETED
@@ -1,75 +0,0 @@
|
|
1
|
-
GIT
|
2
|
-
remote: git://github.com/collectiveidea/delayed_job.git
|
3
|
-
revision: dcd69066144c760922ce2e3e5f538fe1ca6074c5
|
4
|
-
specs:
|
5
|
-
delayed_job (3.0.0)
|
6
|
-
activesupport (~> 3.0)
|
7
|
-
|
8
|
-
PATH
|
9
|
-
remote: .
|
10
|
-
specs:
|
11
|
-
vidibus-recording (0.0.5)
|
12
|
-
activesupport (~> 3)
|
13
|
-
delayed_job_mongoid
|
14
|
-
mongoid (~> 2)
|
15
|
-
vidibus-uuid
|
16
|
-
|
17
|
-
GEM
|
18
|
-
remote: http://rubygems.org/
|
19
|
-
specs:
|
20
|
-
activemodel (3.2.0)
|
21
|
-
activesupport (= 3.2.0)
|
22
|
-
builder (~> 3.0.0)
|
23
|
-
activesupport (3.2.0)
|
24
|
-
i18n (~> 0.6)
|
25
|
-
multi_json (~> 1.0)
|
26
|
-
bson (1.5.2)
|
27
|
-
builder (3.0.0)
|
28
|
-
delayed_job_mongoid (1.0.8)
|
29
|
-
delayed_job (~> 3.0.0)
|
30
|
-
mongoid (>= 2.0)
|
31
|
-
diff-lcs (1.1.3)
|
32
|
-
i18n (0.6.0)
|
33
|
-
macaddr (1.5.0)
|
34
|
-
systemu (>= 2.4.0)
|
35
|
-
mongo (1.5.2)
|
36
|
-
bson (= 1.5.2)
|
37
|
-
mongoid (2.4.1)
|
38
|
-
activemodel (~> 3.1)
|
39
|
-
mongo (~> 1.3)
|
40
|
-
tzinfo (~> 0.3.22)
|
41
|
-
multi_json (1.0.4)
|
42
|
-
rake (0.9.2.2)
|
43
|
-
rcov (1.0.0)
|
44
|
-
rr (1.0.4)
|
45
|
-
rspec (2.8.0)
|
46
|
-
rspec-core (~> 2.8.0)
|
47
|
-
rspec-expectations (~> 2.8.0)
|
48
|
-
rspec-mocks (~> 2.8.0)
|
49
|
-
rspec-core (2.8.0)
|
50
|
-
rspec-expectations (2.8.0)
|
51
|
-
diff-lcs (~> 1.1.2)
|
52
|
-
rspec-mocks (2.8.0)
|
53
|
-
systemu (2.4.2)
|
54
|
-
tzinfo (0.3.31)
|
55
|
-
uuid (2.3.4)
|
56
|
-
macaddr (~> 1.0)
|
57
|
-
vidibus-uuid (0.4.1)
|
58
|
-
mongoid (~> 2)
|
59
|
-
uuid (~> 2.3.1)
|
60
|
-
|
61
|
-
PLATFORMS
|
62
|
-
ruby
|
63
|
-
|
64
|
-
DEPENDENCIES
|
65
|
-
activesupport (~> 3)
|
66
|
-
bundler (>= 1.0.0)
|
67
|
-
delayed_job (= 3.0.0)!
|
68
|
-
delayed_job_mongoid
|
69
|
-
mongoid (~> 2)
|
70
|
-
rake
|
71
|
-
rcov
|
72
|
-
rr
|
73
|
-
rspec (~> 2)
|
74
|
-
vidibus-recording!
|
75
|
-
vidibus-uuid
|
data/spec/log/v22.log
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
RTMPDump v2.2
|
2
|
-
(c) 2010 Andrej Stepanchuk, Howard Chu, The Flvstreamer Team; license: GPL
|
3
|
-
Connecting ...
|
4
|
-
ERROR: rtmp server sent error
|
5
|
-
Starting Live Stream
|
6
|
-
Metadata:
|
7
|
-
author
|
8
|
-
copyright
|
9
|
-
description
|
10
|
-
keywords
|
11
|
-
rating
|
12
|
-
title
|
13
|
-
presetname Custom
|
14
|
-
creationdate Mon Jan 17 15:22:50 2011
|
15
|
-
videodevice Osprey-210 Video Device 1
|
16
|
-
framerate 25.00
|
17
|
-
width 680.00
|
18
|
-
height 394.00
|
19
|
-
videocodecid avc1
|
20
|
-
videodatarate 650.00
|
21
|
-
avclevel 31.00
|
22
|
-
avcprofile 66.00
|
23
|
-
videokeyframe_frequency5.00
|
24
|
-
audiodevice Osprey-210 Audio Device 1
|
25
|
-
audiosamplerate 22050.00
|
26
|
-
audiochannels 1.00
|
27
|
-
audioinputvolume 75.00
|
28
|
-
audiocodecid .mp3
|
29
|
-
audiodatarate 48.00
|
data/spec/log/v23.log
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
RTMPDump v2.3
|
2
|
-
(c) 2010 Andrej Stepanchuk, Howard Chu, The Flvstreamer Team; license: GPL
|
3
|
-
Connecting ...
|
4
|
-
INFO: Connected...
|
5
|
-
ERROR: rtmp server sent error
|
6
|
-
Starting Live Stream
|
7
|
-
INFO: Metadata:
|
8
|
-
INFO: author
|
9
|
-
INFO: copyright
|
10
|
-
INFO: description
|
11
|
-
INFO: keywords
|
12
|
-
INFO: rating
|
13
|
-
INFO: title
|
14
|
-
INFO: presetname Custom
|
15
|
-
INFO: creationdate Mon Jan 17 15:22:50 2011
|
16
|
-
INFO: videodevice Osprey-210 Video Device 1
|
17
|
-
INFO: framerate 25.00
|
18
|
-
INFO: width 680.00
|
19
|
-
INFO: height 394.00
|
20
|
-
INFO: videocodecid avc1
|
21
|
-
INFO: videodatarate 650.00
|
22
|
-
INFO: avclevel 31.00
|
23
|
-
INFO: avcprofile 66.00
|
24
|
-
INFO: videokeyframe_frequency5.00
|
25
|
-
INFO: audiodevice Osprey-210 Audio Device 1
|
26
|
-
INFO: audiosamplerate 22050.00
|
27
|
-
INFO: audiochannels 1.00
|
28
|
-
INFO: audioinputvolume 75.00
|
29
|
-
INFO: audiocodecid .mp3
|
30
|
-
INFO: audiodatarate 48.00
|
data/spec/spec_helper.rb
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
2
|
-
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
|
3
|
-
|
4
|
-
require "rubygems"
|
5
|
-
require "rspec"
|
6
|
-
require "rr"
|
7
|
-
require "mongoid"
|
8
|
-
|
9
|
-
require "vidibus-recording"
|
10
|
-
require "app/models/recording"
|
11
|
-
|
12
|
-
Mongoid.configure do |config|
|
13
|
-
name = "vidibus-recording_test"
|
14
|
-
host = "localhost"
|
15
|
-
config.master = Mongo::Connection.new.db(name)
|
16
|
-
config.logger = nil
|
17
|
-
end
|
18
|
-
|
19
|
-
RSpec.configure do |config|
|
20
|
-
config.mock_with :rr
|
21
|
-
config.before(:each) do
|
22
|
-
Mongoid.master.collections.select {|c| c.name !~ /system/}.each(&:drop)
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
# Helper for stubbing time. Define String to be set as Time.now.
|
27
|
-
# Usage:
|
28
|
-
# stub_time('01.01.2010 14:00')
|
29
|
-
# stub_time(2.days.ago)
|
30
|
-
#
|
31
|
-
def stub_time(string = nil)
|
32
|
-
string ||= Time.now.to_s(:db)
|
33
|
-
now = Time.parse(string.to_s)
|
34
|
-
stub(Time).now { now }
|
35
|
-
now
|
36
|
-
end
|
37
|
-
|
38
|
-
#I18n.load_path += Dir[File.join('config', 'locales', '**', '*.{rb,yml}')]
|
@@ -1,53 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
require "recording/backend/rtmpdump"
|
3
|
-
|
4
|
-
describe "Vidibus::Recording::Backend::Rtmpdump" do
|
5
|
-
|
6
|
-
let(:this) {Vidibus::Recording::Backend::Rtmpdump.new(:stream => "rtmp://test", :file => "test.rec")}
|
7
|
-
let(:log_v22) {File.read("spec/log/v22.log")}
|
8
|
-
let(:log_v23) {File.read("spec/log/v23.log")}
|
9
|
-
|
10
|
-
describe "extract_metadata" do
|
11
|
-
it "should extract relevant metadata from RTMPDump v2.2" do
|
12
|
-
this.extract_metadata(log_v22).should eql({
|
13
|
-
"presetname" => "Custom",
|
14
|
-
"creationdate" => "Mon Jan 17 15:22:50 2011",
|
15
|
-
"videodevice" => "Osprey-210 Video Device 1",
|
16
|
-
"framerate" => "25.00",
|
17
|
-
"width" => "680.00",
|
18
|
-
"height" => "394.00",
|
19
|
-
"videocodecid" => "avc1",
|
20
|
-
"videodatarate" => "650.00",
|
21
|
-
"avclevel" => "31.00",
|
22
|
-
"avcprofile" => "66.00",
|
23
|
-
"audiodevice" => "Osprey-210 Audio Device 1",
|
24
|
-
"audiosamplerate" => "22050.00",
|
25
|
-
"audiochannels" => "1.00",
|
26
|
-
"audioinputvolume" => "75.00",
|
27
|
-
"audiocodecid" => ".mp3",
|
28
|
-
"audiodatarate" => "48.00"
|
29
|
-
})
|
30
|
-
end
|
31
|
-
|
32
|
-
it "should extract relevant metadata from RTMPDump v2.3" do
|
33
|
-
this.extract_metadata(log_v23).should eql({
|
34
|
-
"presetname" => "Custom",
|
35
|
-
"creationdate" => "Mon Jan 17 15:22:50 2011",
|
36
|
-
"videodevice" => "Osprey-210 Video Device 1",
|
37
|
-
"framerate" => "25.00",
|
38
|
-
"width" => "680.00",
|
39
|
-
"height" => "394.00",
|
40
|
-
"videocodecid" => "avc1",
|
41
|
-
"videodatarate" => "650.00",
|
42
|
-
"avclevel" => "31.00",
|
43
|
-
"avcprofile" => "66.00",
|
44
|
-
"audiodevice" => "Osprey-210 Audio Device 1",
|
45
|
-
"audiosamplerate" => "22050.00",
|
46
|
-
"audiochannels" => "1.00",
|
47
|
-
"audioinputvolume" => "75.00",
|
48
|
-
"audiocodecid" => ".mp3",
|
49
|
-
"audiodatarate" => "48.00"
|
50
|
-
})
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
@@ -1,29 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe "Vidibus::Recording::Backend" do
|
4
|
-
|
5
|
-
describe ".load" do
|
6
|
-
it "should return an error unless a stream attribute is given" do
|
7
|
-
expect {
|
8
|
-
Vidibus::Recording::Backend.load({})
|
9
|
-
}.to raise_error(Vidibus::Recording::Backend::ConfigurationError)
|
10
|
-
end
|
11
|
-
|
12
|
-
it "should return a backend instance for given stream protocol" do
|
13
|
-
Vidibus::Recording::Backend.load(:stream => "rtmp://something", :file => "test").
|
14
|
-
should be_an_instance_of(Vidibus::Recording::Backend::Rtmpdump)
|
15
|
-
end
|
16
|
-
|
17
|
-
it "should return an error unless a stream attribute with consumable protocol is given" do
|
18
|
-
expect {
|
19
|
-
Vidibus::Recording::Backend.load({:stream => "mms://something", :file => "test"})
|
20
|
-
}.to raise_error(Vidibus::Recording::Backend::ProtocolError)
|
21
|
-
end
|
22
|
-
|
23
|
-
it "should return an error unless a stream attribute with a protocol is given" do
|
24
|
-
expect {
|
25
|
-
Vidibus::Recording::Backend.load({:stream => "something", :file => "test"})
|
26
|
-
}.to raise_error(Vidibus::Recording::Backend::ProtocolError)
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
@@ -1,111 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe "Vidibus::Recording::Mongoid" do
|
4
|
-
|
5
|
-
let(:this) do
|
6
|
-
Recording.new(:name => "N-TV Live", :stream => "rtmp://fms.rtl.de/ntvlive/livestream/channel1", :live => true)
|
7
|
-
end
|
8
|
-
|
9
|
-
def cleanup(recording)
|
10
|
-
Process.kill("SIGTERM", recording.pid) if recording.pid
|
11
|
-
delete_safely(recording.file)
|
12
|
-
delete_safely(recording.log_file)
|
13
|
-
delete_safely(recording.yml_file)
|
14
|
-
end
|
15
|
-
|
16
|
-
def delete_safely(file)
|
17
|
-
return unless file.match(/.{32}\..{3}/)
|
18
|
-
File.delete(file) if File.exists?(file)
|
19
|
-
end
|
20
|
-
|
21
|
-
describe "validation" do
|
22
|
-
it "should pass with valid attributes" do
|
23
|
-
this.should be_valid
|
24
|
-
end
|
25
|
-
|
26
|
-
it "should fail without a stream" do
|
27
|
-
this.stream = nil
|
28
|
-
this.should be_invalid
|
29
|
-
end
|
30
|
-
|
31
|
-
it "should fail without a valid stream address" do
|
32
|
-
this.stream = "something"
|
33
|
-
this.should be_invalid
|
34
|
-
end
|
35
|
-
|
36
|
-
it "should fail without a valid rtmp stream address" do
|
37
|
-
this.stream = "rtmp://something"
|
38
|
-
this.should be_valid
|
39
|
-
end
|
40
|
-
|
41
|
-
it "should fail without a name" do
|
42
|
-
this.name = nil
|
43
|
-
this.should be_invalid
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
describe "job" do
|
48
|
-
it "should return a job instance" do
|
49
|
-
this.job.should be_an_instance_of(Vidibus::Recording::Job)
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
describe "backend" do
|
54
|
-
it "should return a backend instance for given stream protocol" do
|
55
|
-
this.backend.should be_an_instance_of(Vidibus::Recording::Backend::Rtmpdump)
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
describe "start" do
|
60
|
-
before {this.save}
|
61
|
-
|
62
|
-
it "should return a process id" do
|
63
|
-
this.start.should be_a(Fixnum)
|
64
|
-
end
|
65
|
-
|
66
|
-
context "without params" do
|
67
|
-
it "should start a recording job now" do
|
68
|
-
pid = this.start
|
69
|
-
Vidibus::Recording::Job.running?(pid).should be_true
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
context "with a given Time" do
|
74
|
-
it "should schedule a recording job" do
|
75
|
-
stub_time("2011-01-12 00:00")
|
76
|
-
run_at = 10.minutes.since
|
77
|
-
this.start(run_at)
|
78
|
-
Delayed::Backend::Mongoid::Job.count.should eql(1)
|
79
|
-
Delayed::Backend::Mongoid::Job.first.run_at.should eql(run_at)
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
|
-
after {cleanup(this)}
|
84
|
-
end
|
85
|
-
|
86
|
-
describe "stop" do
|
87
|
-
before {this.save}
|
88
|
-
|
89
|
-
it "should return false unless recording has been started" do
|
90
|
-
this.stop.should be_false
|
91
|
-
end
|
92
|
-
|
93
|
-
it "should return false if recording is done" do
|
94
|
-
this.stopped_at = Time.now
|
95
|
-
this.stop.should be_false
|
96
|
-
end
|
97
|
-
|
98
|
-
context "with started job" do
|
99
|
-
before {this.start}
|
100
|
-
|
101
|
-
it "should stop the recording job" do
|
102
|
-
pid = this.pid
|
103
|
-
this.stop
|
104
|
-
sleep 1
|
105
|
-
Vidibus::Recording::Job.running?(pid).should be_false
|
106
|
-
end
|
107
|
-
|
108
|
-
after {cleanup(this)}
|
109
|
-
end
|
110
|
-
end
|
111
|
-
end
|
data/vidibus-recording.gemspec
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
require File.expand_path("../lib/vidibus/recording/version", __FILE__)
|
3
|
-
|
4
|
-
Gem::Specification.new do |s|
|
5
|
-
s.name = "vidibus-recording"
|
6
|
-
s.version = Vidibus::Recording::VERSION
|
7
|
-
s.platform = Gem::Platform::RUBY
|
8
|
-
s.authors = "Andre Pankratz"
|
9
|
-
s.email = "andre@vidibus.com"
|
10
|
-
s.homepage = "https://github.com/vidibus/vidibus-recording"
|
11
|
-
s.summary = "Video stream recording tools"
|
12
|
-
s.description = "Allows recording of RTMP video streams. Uses RTMPdump."
|
13
|
-
|
14
|
-
s.required_rubygems_version = ">= 1.3.6"
|
15
|
-
|
16
|
-
s.add_dependency "activesupport", "~> 3"
|
17
|
-
s.add_dependency "mongoid", "~> 2"
|
18
|
-
s.add_dependency "delayed_job_mongoid"
|
19
|
-
s.add_dependency "vidibus-uuid"
|
20
|
-
|
21
|
-
s.add_development_dependency "bundler", ">= 1.0.0"
|
22
|
-
s.add_development_dependency "rake"
|
23
|
-
s.add_development_dependency "rspec", "~> 2"
|
24
|
-
s.add_development_dependency "rr"
|
25
|
-
s.add_development_dependency "rcov"
|
26
|
-
|
27
|
-
s.files = `git ls-files`.split("\n")
|
28
|
-
s.executables = `git ls-files`.split("\n").map{|f| f =~ /^bin\/(.*)/ ? $1 : nil}.compact
|
29
|
-
s.require_path = 'lib'
|
30
|
-
end
|