yamdi 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.rspec +1 -0
- data/Changelog.mdown +3 -0
- data/Gemfile +15 -0
- data/Gemfile.lock +30 -0
- data/LICENSE.txt +20 -0
- data/README.rdoc +82 -0
- data/Rakefile +50 -0
- data/VERSION +1 -0
- data/lib/paperclip_processors/metadata_extractor.rb +16 -0
- data/lib/yamdi.rb +150 -0
- data/spec/files/sample.flv +0 -0
- data/spec/spec_helper.rb +13 -0
- data/spec/yamdi_spec.rb +141 -0
- metadata +175 -0
data/.document
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/Changelog.mdown
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
source "http://rubygems.org"
|
2
|
+
# Add dependencies required to use your gem here.
|
3
|
+
# Example:
|
4
|
+
# gem "activesupport", ">= 2.3.5"
|
5
|
+
|
6
|
+
gem "nokogiri", "~> 1.4.4"
|
7
|
+
|
8
|
+
# Add dependencies to develop your gem here.
|
9
|
+
# Include everything needed to run rake, tests, features, etc.
|
10
|
+
group :development do
|
11
|
+
gem "rspec", "~> 2.3.0"
|
12
|
+
gem "bundler", "~> 1.0.0"
|
13
|
+
gem "jeweler", "~> 1.5.2"
|
14
|
+
gem "rcov", ">= 0"
|
15
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
diff-lcs (1.1.2)
|
5
|
+
git (1.2.5)
|
6
|
+
jeweler (1.5.2)
|
7
|
+
bundler (~> 1.0.0)
|
8
|
+
git (>= 1.2.5)
|
9
|
+
rake
|
10
|
+
nokogiri (1.4.4)
|
11
|
+
rake (0.8.7)
|
12
|
+
rcov (0.9.9)
|
13
|
+
rspec (2.3.0)
|
14
|
+
rspec-core (~> 2.3.0)
|
15
|
+
rspec-expectations (~> 2.3.0)
|
16
|
+
rspec-mocks (~> 2.3.0)
|
17
|
+
rspec-core (2.3.1)
|
18
|
+
rspec-expectations (2.3.0)
|
19
|
+
diff-lcs (~> 1.1.2)
|
20
|
+
rspec-mocks (2.3.0)
|
21
|
+
|
22
|
+
PLATFORMS
|
23
|
+
ruby
|
24
|
+
|
25
|
+
DEPENDENCIES
|
26
|
+
bundler (~> 1.0.0)
|
27
|
+
jeweler (~> 1.5.2)
|
28
|
+
nokogiri (~> 1.4.4)
|
29
|
+
rcov
|
30
|
+
rspec (~> 2.3.0)
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2011 Bob Burbach
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
= yamdi
|
2
|
+
|
3
|
+
Yamdi is a ruby wrapper around the command line tool yamdi (github.com/ioppermann/yamdi). You'll need yamdi installed in order for the gem to be of any use. If you are on OSX I recommend using homebrew (brew install yamdi).
|
4
|
+
|
5
|
+
The Yamdi command line tool expects to receive a path to an flv file and will return XML file of the extracted metadata that we then wrap in a ruby object and use to expose the metadata.
|
6
|
+
|
7
|
+
The current gem version only supports the reading of metadata. The command line tool also supports the writing of the metadata into a new .flv file but this is not yet supported in this gem.
|
8
|
+
|
9
|
+
|
10
|
+
== Usage
|
11
|
+
|
12
|
+
@metadata = Yamdi.new('path/to/file.flv')
|
13
|
+
|
14
|
+
@metadata.duration #=> 6.02
|
15
|
+
|
16
|
+
@metadata.key_frames.each do |key_frame|
|
17
|
+
key_frame.time #=> 5.87
|
18
|
+
key_frame.location #=> 13467
|
19
|
+
end
|
20
|
+
|
21
|
+
=== Paperclip Processor
|
22
|
+
|
23
|
+
You can also use Yamdi in a Paperclip processor. I've provided a simple example in lib/paperclip_processors/metadata_extractor.rb
|
24
|
+
|
25
|
+
This is useful for adding things like video duration to your db when a user uploads a video.
|
26
|
+
|
27
|
+
== Supported methods
|
28
|
+
|
29
|
+
duration :: float, in seconds
|
30
|
+
|
31
|
+
has_keyframes? :: boolean
|
32
|
+
has_video? :: boolean
|
33
|
+
has_audio? :: boolean
|
34
|
+
has_metadata? :: boolean
|
35
|
+
has_cue_points? :: boolean
|
36
|
+
can_seek_to_end? :: boolean
|
37
|
+
|
38
|
+
audio_codec_id :: integer
|
39
|
+
audio_sample_rate :: integer
|
40
|
+
audio_data_rate :: integer
|
41
|
+
audio_sample_size :: integer
|
42
|
+
audio_delay :: float, in seconds
|
43
|
+
|
44
|
+
stereo? :: boolean
|
45
|
+
|
46
|
+
video_codec_id :: integer
|
47
|
+
frame_rate :: float, in seconds
|
48
|
+
video_data_rate :: integer
|
49
|
+
|
50
|
+
height :: integer
|
51
|
+
width :: integer
|
52
|
+
|
53
|
+
data_size :: integer
|
54
|
+
audio_size :: integer
|
55
|
+
video_size :: integer
|
56
|
+
file_size :: integer
|
57
|
+
|
58
|
+
last_timestamp :: float, in seconds
|
59
|
+
last_video_frame_timestamp :: float, in seconds
|
60
|
+
last_key_frame_timestamp :: float, in seconds
|
61
|
+
last_key_frame_location :: integer
|
62
|
+
|
63
|
+
key_frames :: Array of key frame data, each item contains the following
|
64
|
+
- time :: float, in seconds
|
65
|
+
- location :: integer
|
66
|
+
|
67
|
+
|
68
|
+
== Contributing to yamdi
|
69
|
+
|
70
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
|
71
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
|
72
|
+
* Fork the project
|
73
|
+
* Start a feature/bugfix branch
|
74
|
+
* Commit and push until you are happy with your contribution
|
75
|
+
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
76
|
+
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
77
|
+
|
78
|
+
== Copyright
|
79
|
+
|
80
|
+
Copyright (c) 2011 Bob Burbach. See LICENSE.txt for
|
81
|
+
further details.
|
82
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler'
|
3
|
+
begin
|
4
|
+
Bundler.setup(:default, :development)
|
5
|
+
rescue Bundler::BundlerError => e
|
6
|
+
$stderr.puts e.message
|
7
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
8
|
+
exit e.status_code
|
9
|
+
end
|
10
|
+
require 'rake'
|
11
|
+
|
12
|
+
require 'jeweler'
|
13
|
+
Jeweler::Tasks.new do |gem|
|
14
|
+
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
15
|
+
gem.name = "yamdi"
|
16
|
+
gem.homepage = "http://github.com/peregrinator/yamdi"
|
17
|
+
gem.license = "MIT"
|
18
|
+
gem.summary = %Q{Yamdi is a ruby wrapper around the command line tool yamdi (github.com/ioppermann/yamdi).}
|
19
|
+
gem.description = %Q{Yamdi is a ruby wrapper around the command line tool yamdi (github.com/ioppermann/yamdi). You'll need yamdi installed in order for the gem to be of any use. If you are on OSX I recommend using homebrew (brew install yamdi).}
|
20
|
+
gem.email = "bob.burbach@gmail.com"
|
21
|
+
gem.authors = ["Bob Burbach"]
|
22
|
+
|
23
|
+
# Include your dependencies below. Runtime dependencies are required when using your gem,
|
24
|
+
# and development dependencies are only needed for development (ie running rake tasks, tests, etc)
|
25
|
+
gem.add_runtime_dependency 'nokogiri', '~> 1.4.4'
|
26
|
+
end
|
27
|
+
Jeweler::RubygemsDotOrgTasks.new
|
28
|
+
|
29
|
+
require 'rspec/core'
|
30
|
+
require 'rspec/core/rake_task'
|
31
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
32
|
+
spec.pattern = FileList['spec/**/*_spec.rb']
|
33
|
+
end
|
34
|
+
|
35
|
+
RSpec::Core::RakeTask.new(:rcov) do |spec|
|
36
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
37
|
+
spec.rcov = true
|
38
|
+
end
|
39
|
+
|
40
|
+
task :default => :spec
|
41
|
+
|
42
|
+
require 'rake/rdoctask'
|
43
|
+
Rake::RDocTask.new do |rdoc|
|
44
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
45
|
+
|
46
|
+
rdoc.rdoc_dir = 'rdoc'
|
47
|
+
rdoc.title = "yamdi #{version}"
|
48
|
+
rdoc.rdoc_files.include('README*')
|
49
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
50
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.0
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Paperclip
|
2
|
+
class MetadataExtractor < Paperclip::Processor
|
3
|
+
def make
|
4
|
+
# get the metadata from Yamdi
|
5
|
+
metadata = Yamdi.new(file.path)
|
6
|
+
|
7
|
+
# add values to the attachment instance (for db persistence, etc)
|
8
|
+
# assumes duration is a column in the table this attachment is being
|
9
|
+
# added to.
|
10
|
+
attachment.instance.duration = metadata.duration
|
11
|
+
|
12
|
+
# always return a reference to the file when done
|
13
|
+
file
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
data/lib/yamdi.rb
ADDED
@@ -0,0 +1,150 @@
|
|
1
|
+
require 'tempfile'
|
2
|
+
require 'ostruct'
|
3
|
+
|
4
|
+
class Yamdi
|
5
|
+
|
6
|
+
def initialize(flv_path)
|
7
|
+
@metadata = Nokogiri.parse( parse(flv_path) )
|
8
|
+
end
|
9
|
+
|
10
|
+
def parse(flv_path)
|
11
|
+
temp_file = Tempfile.new('yamdi_tmp')
|
12
|
+
`yamdi -i #{flv_path} -x #{temp_file.path}`
|
13
|
+
contents = temp_file.read
|
14
|
+
temp_file.close
|
15
|
+
contents
|
16
|
+
end
|
17
|
+
|
18
|
+
def duration
|
19
|
+
@metadata.xpath("//duration").inner_text.to_f
|
20
|
+
end
|
21
|
+
|
22
|
+
def has_keyframes?
|
23
|
+
boolean @metadata.xpath("//hasKeyframes").inner_text
|
24
|
+
end
|
25
|
+
|
26
|
+
def has_video?
|
27
|
+
boolean @metadata.xpath("//hasVideo").inner_text
|
28
|
+
end
|
29
|
+
|
30
|
+
def has_audio?
|
31
|
+
boolean @metadata.xpath("//hasAudio").inner_text
|
32
|
+
end
|
33
|
+
|
34
|
+
def has_metadata?
|
35
|
+
boolean @metadata.xpath("//hasMetadata").inner_text
|
36
|
+
end
|
37
|
+
|
38
|
+
def has_cue_points?
|
39
|
+
boolean @metadata.xpath("//hasCuePoints").inner_text
|
40
|
+
end
|
41
|
+
|
42
|
+
def can_seek_to_end?
|
43
|
+
boolean @metadata.xpath("//canSeekToEnd").inner_text
|
44
|
+
end
|
45
|
+
|
46
|
+
def audio_codec_id
|
47
|
+
@metadata.xpath("//audiocodecid").inner_text.to_i
|
48
|
+
end
|
49
|
+
|
50
|
+
def audio_sample_rate
|
51
|
+
@metadata.xpath("//audiosamplerate").inner_text.to_i
|
52
|
+
end
|
53
|
+
|
54
|
+
def audio_data_rate
|
55
|
+
@metadata.xpath("//audiodatarate").inner_text.to_i
|
56
|
+
end
|
57
|
+
|
58
|
+
def audio_sample_size
|
59
|
+
@metadata.xpath("//audiosamplesize").inner_text.to_i
|
60
|
+
end
|
61
|
+
|
62
|
+
def audio_delay
|
63
|
+
@metadata.xpath("//audiodelay").inner_text.to_f
|
64
|
+
end
|
65
|
+
|
66
|
+
def stereo?
|
67
|
+
boolean @metadata.xpath("//stereo").inner_text
|
68
|
+
end
|
69
|
+
|
70
|
+
def video_codec_id
|
71
|
+
@metadata.xpath("//videocodecid").inner_text.to_i
|
72
|
+
end
|
73
|
+
|
74
|
+
def frame_rate
|
75
|
+
@metadata.xpath("//framerate").inner_text.to_f
|
76
|
+
end
|
77
|
+
|
78
|
+
def video_data_rate
|
79
|
+
@metadata.xpath("//videodatarate").inner_text.to_i
|
80
|
+
end
|
81
|
+
|
82
|
+
def height
|
83
|
+
@metadata.xpath("//height").inner_text.to_i
|
84
|
+
end
|
85
|
+
|
86
|
+
def width
|
87
|
+
@metadata.xpath("//width").inner_text.to_i
|
88
|
+
end
|
89
|
+
|
90
|
+
def data_size
|
91
|
+
@metadata.xpath("//datasize").inner_text.to_i
|
92
|
+
end
|
93
|
+
|
94
|
+
def audio_size
|
95
|
+
@metadata.xpath("//audiosize").inner_text.to_i
|
96
|
+
end
|
97
|
+
|
98
|
+
def video_size
|
99
|
+
@metadata.xpath("//videosize").inner_text.to_i
|
100
|
+
end
|
101
|
+
|
102
|
+
def file_size
|
103
|
+
@metadata.xpath("//filesize").inner_text.to_i
|
104
|
+
end
|
105
|
+
|
106
|
+
def last_timestamp
|
107
|
+
@metadata.xpath("//lasttimestamp").inner_text.to_f
|
108
|
+
end
|
109
|
+
|
110
|
+
def last_video_frame_timestamp
|
111
|
+
@metadata.xpath("//lastvideoframetimestamp").inner_text.to_f
|
112
|
+
end
|
113
|
+
|
114
|
+
def last_key_frame_timestamp
|
115
|
+
@metadata.xpath("//lastkeyframetimestamp").inner_text.to_f
|
116
|
+
end
|
117
|
+
|
118
|
+
def last_key_frame_location
|
119
|
+
@metadata.xpath("//lastkeyframelocation").inner_text.to_i
|
120
|
+
end
|
121
|
+
|
122
|
+
def key_frames
|
123
|
+
times_data_xml = @metadata.xpath("//keyframes/times/value")
|
124
|
+
times = []
|
125
|
+
times_data_xml.children.each do |el|
|
126
|
+
times << el.inner_text.to_f
|
127
|
+
end
|
128
|
+
|
129
|
+
file_positions_xml = @metadata.xpath("//keyframes/filepositions/value")
|
130
|
+
file_positions = []
|
131
|
+
file_positions_xml.children.each do |el|
|
132
|
+
file_positions << el.inner_text.to_i
|
133
|
+
end
|
134
|
+
|
135
|
+
count = 0
|
136
|
+
key_frames = []
|
137
|
+
while count < times.size do
|
138
|
+
key_frames << OpenStruct.new(:time => times[count], :file_position => file_positions[count])
|
139
|
+
count = count + 1
|
140
|
+
end
|
141
|
+
|
142
|
+
key_frames
|
143
|
+
end
|
144
|
+
|
145
|
+
private
|
146
|
+
|
147
|
+
def boolean(string)
|
148
|
+
string == 'true' ? true : (string == 'false' ? false : string)
|
149
|
+
end
|
150
|
+
end
|
Binary file
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
2
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
3
|
+
require 'rspec'
|
4
|
+
require 'yamdi'
|
5
|
+
require 'nokogiri'
|
6
|
+
|
7
|
+
# Requires supporting files with custom matchers and macros, etc,
|
8
|
+
# in ./support/ and its subdirectories.
|
9
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
10
|
+
|
11
|
+
RSpec.configure do |config|
|
12
|
+
|
13
|
+
end
|
data/spec/yamdi_spec.rb
ADDED
@@ -0,0 +1,141 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
|
3
|
+
describe "Yamdi" do
|
4
|
+
it "expects the yamdi command line tool to be installed" do
|
5
|
+
system `which yamdi`
|
6
|
+
$?.exitstatus.should eq(1)
|
7
|
+
end
|
8
|
+
|
9
|
+
let(:flv_path) { File.join(File.dirname(__FILE__), 'files', 'sample.flv') }
|
10
|
+
|
11
|
+
before(:all) do
|
12
|
+
@yamdi = Yamdi.new(flv_path)
|
13
|
+
end
|
14
|
+
|
15
|
+
it "#duration returns the duration of the flv file" do
|
16
|
+
@yamdi.duration.should eq(6.06)
|
17
|
+
end
|
18
|
+
|
19
|
+
it "#has_keyframes? returns hasKeyframes" do
|
20
|
+
@yamdi.has_keyframes?.should eq(true)
|
21
|
+
end
|
22
|
+
|
23
|
+
it "#has_video? returns hasVideo" do
|
24
|
+
@yamdi.has_video?.should eq(true)
|
25
|
+
end
|
26
|
+
|
27
|
+
it "#has_audio? returns hasAudio" do
|
28
|
+
@yamdi.has_audio?.should eq(true)
|
29
|
+
end
|
30
|
+
|
31
|
+
it "#has_metadata? returns hasMetadata" do
|
32
|
+
@yamdi.has_metadata?.should eq(true)
|
33
|
+
end
|
34
|
+
|
35
|
+
it "#has_cue_points? returns hasCuePoints" do
|
36
|
+
@yamdi.has_cue_points?.should eq(false)
|
37
|
+
end
|
38
|
+
|
39
|
+
it "#can_seek_to_end? returns canSeekToEnd" do
|
40
|
+
@yamdi.can_seek_to_end?.should eq(true)
|
41
|
+
end
|
42
|
+
|
43
|
+
it "#audio_codec_id returns audiocodecid" do
|
44
|
+
@yamdi.audio_codec_id.should eq(2)
|
45
|
+
end
|
46
|
+
|
47
|
+
it "#audio_sample_rate returns audiosamplerate" do
|
48
|
+
@yamdi.audio_sample_rate.should eq(3)
|
49
|
+
end
|
50
|
+
|
51
|
+
it "#audio_data_rate returns audiodatarate" do
|
52
|
+
@yamdi.audio_data_rate.should eq(94)
|
53
|
+
end
|
54
|
+
|
55
|
+
it "#audio_sample_size returns audiosamplesize" do
|
56
|
+
@yamdi.audio_sample_size.should eq(1)
|
57
|
+
end
|
58
|
+
|
59
|
+
it "#audio_delay returns audiodelay" do
|
60
|
+
@yamdi.audio_delay.should eq(0.00)
|
61
|
+
end
|
62
|
+
|
63
|
+
it "#stereo? returns stereo" do
|
64
|
+
@yamdi.stereo?.should eq(true)
|
65
|
+
end
|
66
|
+
|
67
|
+
it "#video_codec_id returns videocodecid" do
|
68
|
+
@yamdi.video_codec_id.should eq(4)
|
69
|
+
end
|
70
|
+
|
71
|
+
it "#frame_rate returns framerate" do
|
72
|
+
@yamdi.frame_rate.should eq(0.33)
|
73
|
+
end
|
74
|
+
|
75
|
+
it "#video_data_rate returns videodatarate" do
|
76
|
+
@yamdi.video_data_rate.should eq(14)
|
77
|
+
end
|
78
|
+
|
79
|
+
it "#height returns height" do
|
80
|
+
@yamdi.height.should eq(288)
|
81
|
+
end
|
82
|
+
|
83
|
+
it "#width returns height" do
|
84
|
+
@yamdi.width.should eq(360)
|
85
|
+
end
|
86
|
+
|
87
|
+
it "#data_size returns datasize" do
|
88
|
+
@yamdi.data_size.should eq(88470)
|
89
|
+
end
|
90
|
+
|
91
|
+
it "#audio_size returns audiosize" do
|
92
|
+
@yamdi.audio_size.should eq(75958)
|
93
|
+
end
|
94
|
+
|
95
|
+
it "#video_size returns videosize" do
|
96
|
+
@yamdi.video_size.should eq(11572)
|
97
|
+
end
|
98
|
+
|
99
|
+
it "#file_size returns filesize" do
|
100
|
+
@yamdi.file_size.should eq(89137)
|
101
|
+
end
|
102
|
+
|
103
|
+
it "#last_timestamp returns lasttimestamp" do
|
104
|
+
@yamdi.last_timestamp.should eq(6.06)
|
105
|
+
end
|
106
|
+
|
107
|
+
it "#last_video_frame_timestamp returns lastvideoframetimestamp" do
|
108
|
+
@yamdi.last_video_frame_timestamp.should eq(6.04)
|
109
|
+
end
|
110
|
+
|
111
|
+
it "#last_key_frame_timestamp returns lastkeyframetimestamp" do
|
112
|
+
@yamdi.last_key_frame_timestamp.should eq(6.04)
|
113
|
+
end
|
114
|
+
|
115
|
+
it "#last_key_frame_location returns lastkeyframelocation" do
|
116
|
+
@yamdi.last_key_frame_location.should eq(83017)
|
117
|
+
end
|
118
|
+
|
119
|
+
context "key frames" do
|
120
|
+
before(:all) do
|
121
|
+
@key_frame_1 = @yamdi.key_frames.first
|
122
|
+
@key_frame_2 = @yamdi.key_frames.last
|
123
|
+
end
|
124
|
+
|
125
|
+
it "returns an array of key frame open structs" do
|
126
|
+
@yamdi.key_frames.class.should eq(Array)
|
127
|
+
@yamdi.key_frames.first.class.should eq(OpenStruct)
|
128
|
+
@yamdi.key_frames.last.class.should eq(OpenStruct)
|
129
|
+
end
|
130
|
+
|
131
|
+
it "returns the proper time values" do
|
132
|
+
@key_frame_1.time.should eq(0.04)
|
133
|
+
@key_frame_2.time.should eq(6.04)
|
134
|
+
end
|
135
|
+
|
136
|
+
it "returns the proper file position values" do
|
137
|
+
@key_frame_1.file_position.should eq(1327)
|
138
|
+
@key_frame_2.file_position.should eq(83017)
|
139
|
+
end
|
140
|
+
end
|
141
|
+
end
|
metadata
ADDED
@@ -0,0 +1,175 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: yamdi
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 27
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
- 0
|
10
|
+
version: 0.1.0
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Bob Burbach
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2011-01-22 00:00:00 -08:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: nokogiri
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 15
|
30
|
+
segments:
|
31
|
+
- 1
|
32
|
+
- 4
|
33
|
+
- 4
|
34
|
+
version: 1.4.4
|
35
|
+
type: :runtime
|
36
|
+
version_requirements: *id001
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: rspec
|
39
|
+
prerelease: false
|
40
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
hash: 3
|
46
|
+
segments:
|
47
|
+
- 2
|
48
|
+
- 3
|
49
|
+
- 0
|
50
|
+
version: 2.3.0
|
51
|
+
type: :development
|
52
|
+
version_requirements: *id002
|
53
|
+
- !ruby/object:Gem::Dependency
|
54
|
+
name: bundler
|
55
|
+
prerelease: false
|
56
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
hash: 23
|
62
|
+
segments:
|
63
|
+
- 1
|
64
|
+
- 0
|
65
|
+
- 0
|
66
|
+
version: 1.0.0
|
67
|
+
type: :development
|
68
|
+
version_requirements: *id003
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: jeweler
|
71
|
+
prerelease: false
|
72
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ~>
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
hash: 7
|
78
|
+
segments:
|
79
|
+
- 1
|
80
|
+
- 5
|
81
|
+
- 2
|
82
|
+
version: 1.5.2
|
83
|
+
type: :development
|
84
|
+
version_requirements: *id004
|
85
|
+
- !ruby/object:Gem::Dependency
|
86
|
+
name: rcov
|
87
|
+
prerelease: false
|
88
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ">="
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
hash: 3
|
94
|
+
segments:
|
95
|
+
- 0
|
96
|
+
version: "0"
|
97
|
+
type: :development
|
98
|
+
version_requirements: *id005
|
99
|
+
- !ruby/object:Gem::Dependency
|
100
|
+
name: nokogiri
|
101
|
+
prerelease: false
|
102
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
103
|
+
none: false
|
104
|
+
requirements:
|
105
|
+
- - ~>
|
106
|
+
- !ruby/object:Gem::Version
|
107
|
+
hash: 15
|
108
|
+
segments:
|
109
|
+
- 1
|
110
|
+
- 4
|
111
|
+
- 4
|
112
|
+
version: 1.4.4
|
113
|
+
type: :runtime
|
114
|
+
version_requirements: *id006
|
115
|
+
description: Yamdi is a ruby wrapper around the command line tool yamdi (github.com/ioppermann/yamdi). You'll need yamdi installed in order for the gem to be of any use. If you are on OSX I recommend using homebrew (brew install yamdi).
|
116
|
+
email: bob.burbach@gmail.com
|
117
|
+
executables: []
|
118
|
+
|
119
|
+
extensions: []
|
120
|
+
|
121
|
+
extra_rdoc_files:
|
122
|
+
- LICENSE.txt
|
123
|
+
- README.rdoc
|
124
|
+
files:
|
125
|
+
- .document
|
126
|
+
- .rspec
|
127
|
+
- Changelog.mdown
|
128
|
+
- Gemfile
|
129
|
+
- Gemfile.lock
|
130
|
+
- LICENSE.txt
|
131
|
+
- README.rdoc
|
132
|
+
- Rakefile
|
133
|
+
- VERSION
|
134
|
+
- lib/paperclip_processors/metadata_extractor.rb
|
135
|
+
- lib/yamdi.rb
|
136
|
+
- spec/files/sample.flv
|
137
|
+
- spec/spec_helper.rb
|
138
|
+
- spec/yamdi_spec.rb
|
139
|
+
has_rdoc: true
|
140
|
+
homepage: http://github.com/peregrinator/yamdi
|
141
|
+
licenses:
|
142
|
+
- MIT
|
143
|
+
post_install_message:
|
144
|
+
rdoc_options: []
|
145
|
+
|
146
|
+
require_paths:
|
147
|
+
- lib
|
148
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
149
|
+
none: false
|
150
|
+
requirements:
|
151
|
+
- - ">="
|
152
|
+
- !ruby/object:Gem::Version
|
153
|
+
hash: 3
|
154
|
+
segments:
|
155
|
+
- 0
|
156
|
+
version: "0"
|
157
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
158
|
+
none: false
|
159
|
+
requirements:
|
160
|
+
- - ">="
|
161
|
+
- !ruby/object:Gem::Version
|
162
|
+
hash: 3
|
163
|
+
segments:
|
164
|
+
- 0
|
165
|
+
version: "0"
|
166
|
+
requirements: []
|
167
|
+
|
168
|
+
rubyforge_project:
|
169
|
+
rubygems_version: 1.3.7
|
170
|
+
signing_key:
|
171
|
+
specification_version: 3
|
172
|
+
summary: Yamdi is a ruby wrapper around the command line tool yamdi (github.com/ioppermann/yamdi).
|
173
|
+
test_files:
|
174
|
+
- spec/spec_helper.rb
|
175
|
+
- spec/yamdi_spec.rb
|