kelredd-pruview 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of kelredd-pruview might be problematic. Click here for more details.

data/.gitignore ADDED
@@ -0,0 +1,6 @@
1
+ pkg/*
2
+ .bundle
3
+ *.gem
4
+ *.log
5
+ /test/output/
6
+ /test_output
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify dependencies in rbht.gemspec
4
+ gemspec
5
+
6
+ gem 'rake'
data/Gemfile.lock ADDED
@@ -0,0 +1,34 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ kelredd-pruview (0.2.3)
5
+ flvtool2
6
+ mini_magick (~> 3.0)
7
+
8
+ GEM
9
+ remote: http://rubygems.org/
10
+ specs:
11
+ flvtool2 (1.0.6)
12
+ json (1.4.6)
13
+ kelredd-useful (0.4.2)
14
+ json
15
+ leftright (0.9.1)
16
+ mini_magick (3.2)
17
+ subexec (~> 0.0.4)
18
+ rake (0.9.2)
19
+ shoulda (2.11.3)
20
+ subexec (0.0.4)
21
+ test-belt (1.1.2)
22
+ leftright (~> 0.9.0)
23
+
24
+ PLATFORMS
25
+ ruby
26
+
27
+ DEPENDENCIES
28
+ bundler (~> 1.0)
29
+ kelredd-pruview!
30
+ kelredd-useful (>= 0.4.0)
31
+ leftright (>= 0.0.6)
32
+ rake
33
+ shoulda (>= 2.10.0)
34
+ test-belt (~> 1.0)
data/Rakefile CHANGED
@@ -1,45 +1,9 @@
1
- require 'rubygems'
2
- require 'rake/gempackagetask'
3
- require 'simple_gem/testtasks'
1
+ include Rake::DSL
4
2
 
5
- require 'lib/pruview/version'
3
+ require 'bundler'
4
+ Bundler::GemHelper.install_tasks
6
5
 
7
- task :default => :test
8
-
9
- spec = Gem::Specification.new do |s|
10
- s.name = 'kelredd-pruview'
11
- s.version = Pruview::Version.to_s
12
- s.has_rdoc = true
13
- s.extra_rdoc_files = %w(README.rdoc)
14
- s.rdoc_options = %w(--main README.rdoc)
15
- s.summary = "A gem to ease generating image previews (thumbnails) of various files"
16
- s.author = 'Kelly Redding'
17
- s.email = 'kelly@kelredd.com'
18
- s.homepage = 'http://github.com/kelredd/pruview'
19
- s.files = %w(README.rdoc Rakefile) + Dir.glob("{bin,features,lib,test}/**/*")
20
- # s.executables = ['pruview']
21
-
22
- s.add_development_dependency("shoulda", [">= 2.10.0"])
23
- s.add_development_dependency("leftright", [">= 0.0.6"])
24
- s.add_development_dependency("kelredd-useful", [">= 0.4.0"])
25
- s.add_development_dependency("kelredd-simple-gem", [">= 0.7.0"])
26
-
27
- s.add_dependency('mini_magick', "~>3.0")
28
- s.add_dependency('flvtool2')
29
- end
30
-
31
- Rake::GemPackageTask.new(spec) do |pkg|
32
- pkg.gem_spec = spec
33
- end
34
-
35
- SimpleGem::TestTasks.new
36
-
37
- desc 'Generate the gemspec for this gem'
38
- task :gemspec do
39
- file = File.dirname(__FILE__) + "/#{spec.name}.gemspec"
40
- File.open(file, 'w') {|f| f << spec.to_ruby }
41
- puts "Created gemspec: #{file}"
42
- end
43
-
44
- task :default => :gem
6
+ require 'test_belt/rake_tasks'
7
+ TestBelt::RakeTasks.for :test
45
8
 
9
+ task :default => :build
data/bin/ffyml CHANGED
@@ -30,40 +30,40 @@ output_file=$2
30
30
  temp_out="/tmp/ffinfo.tmp"
31
31
 
32
32
  # run ffmpeg in a known error state and capture it's file properties output from standard error
33
- echo "ffmpeg -i $video_file 2> $temp_out"
33
+ echo "ffmpeg -i \"$video_file\" 2> \"$temp_out\""
34
34
  ffmpeg -i "$video_file" 2> "$temp_out"
35
35
 
36
36
  # parse temp_out for the file properties
37
37
  # format
38
- var_format=`cat $temp_out | grep "Input #0" | gawk -F', ' '{print $2}'`
39
- var_duration=`cat $temp_out | grep "Duration:" | gawk -F': ' '{print $2}' | gawk -F', ' '{print $1}'`
40
- var_bitrate=`cat $temp_out | grep "Duration:" | gawk -F': ' '{print $4}' | gawk -F' ' '{print $1}'`
41
- var_codec=`cat $temp_out | grep "Video:" | gawk -F': ' '{print $3}' | gawk -F', ' '{print $1}'`
42
- var_width=`cat $temp_out | grep "Video:" | gawk -F': ' '{print $3}' | gawk -F', ' '{print $3}' | gawk -F'x' '{print $1}'`
43
- var_height=`cat $temp_out | grep "Video:" | gawk -F': ' '{print $3}' | gawk -F', ' '{print $3}' | gawk -F'x' '{print $2}' | gawk -F' ' '{print $1}'`
44
- var_framerate=`cat $temp_out | grep "Video:" | gawk -F': ' '{print $3}' | gawk -F', ' '{print $5}' | gawk -F' ' '{print $1}'`
38
+ var_format=`cat "$temp_out" | grep "Input #0" | gawk -F', ' '{print $2}'`
39
+ var_duration=`cat "$temp_out" | grep "Duration:" | gawk -F': ' '{print $2}' | gawk -F', ' '{print $1}'`
40
+ var_bitrate=`cat "$temp_out" | grep "Duration:" | gawk -F': ' '{print $4}' | gawk -F' ' '{print $1}'`
41
+ var_codec=`cat "$temp_out" | grep "Video:" | gawk -F': ' '{print $3}' | gawk -F', ' '{print $1}'`
42
+ var_width=`cat "$temp_out" | grep "Video:" | gawk -F': ' '{print $3}' | gawk -F', ' '{print $3}' | gawk -F'x' '{print $1}'`
43
+ var_height=`cat "$temp_out" | grep "Video:" | gawk -F': ' '{print $3}' | gawk -F', ' '{print $3}' | gawk -F'x' '{print $2}' | gawk -F' ' '{print $1}'`
44
+ var_framerate=`cat "$temp_out" | grep "Video:" | gawk -F': ' '{print $3}' | gawk -F', ' '{print $5}' | gawk -F' ' '{print $1}'`
45
45
  if [ "$var_framerate" = "" ]; then
46
- var_framerate=`cat $temp_out | grep "Video:" | gawk -F': ' '{print $3}' | gawk -F', ' '{print $4}' | gawk -F' ' '{print $1}'`
46
+ var_framerate=`cat "$temp_out" | grep "Video:" | gawk -F': ' '{print $3}' | gawk -F', ' '{print $4}' | gawk -F' ' '{print $1}'`
47
47
  fi
48
- var_audio_codec=`cat $temp_out | grep "Audio:" | gawk -F': ' '{print $3}' | gawk -F', ' '{print $1}'`
49
- var_audio_bitrate=`cat $temp_out | grep "Audio:" | gawk -F', ' '{print $5}' | gawk -F' ' '{print $1}'`
50
- var_audio_sampling=`cat $temp_out | grep "Audio:" | gawk -F', ' '{print $2}' | gawk -F' ' '{print $1}'`
48
+ var_audio_codec=`cat "$temp_out" | grep "Audio:" | gawk -F': ' '{print $3}' | gawk -F', ' '{print $1}'`
49
+ var_audio_bitrate=`cat "$temp_out" | grep "Audio:" | gawk -F', ' '{print $5}' | gawk -F' ' '{print $1}'`
50
+ var_audio_sampling=`cat "$temp_out" | grep "Audio:" | gawk -F', ' '{print $2}' | gawk -F' ' '{print $1}'`
51
51
 
52
52
  # write the output YAML file
53
- echo "# file properties" > $output_file
54
- echo format: $var_format >> $output_file
55
- echo duration: $var_duration >> $output_file
56
- echo bitrate: $var_bitrate >> $output_file
57
- echo codec: $var_codec >> $output_file
58
- echo width: $var_width >> $output_file
59
- echo height: $var_height >> $output_file
60
- echo framerate: $var_framerate >> $output_file
61
- echo audio_codec: $var_audio_codec >> $output_file
62
- echo audio_bitrate: $var_audio_bitrate >> $output_file
63
- echo audio_sampling: $var_audio_sampling >> $output_file
53
+ echo "# file properties" > "$output_file"
54
+ echo "format: $var_format" >> "$output_file"
55
+ echo "duration: $var_duration" >> "$output_file"
56
+ echo "bitrate: $var_bitrate" >> "$output_file"
57
+ echo "codec: $var_codec" >> "$output_file"
58
+ echo "width: $var_width" >> "$output_file"
59
+ echo "height: $var_height" >> "$output_file"
60
+ echo "framerate: $var_framerate" >> "$output_file"
61
+ echo "audio_codec: $var_audio_codec" >> "$output_file"
62
+ echo "audio_bitrate: $var_audio_bitrate" >> "$output_file"
63
+ echo "audio_sampling: $var_audio_sampling" >> "$output_file"
64
64
 
65
65
  # cleanup
66
- rm $temp_out
66
+ rm "$temp_out"
67
67
 
68
68
  echo "Done."
69
69
 
@@ -0,0 +1,27 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "pruview/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "kelredd-pruview"
7
+ s.version = Pruview::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ["Kelly D. Redding"]
10
+ s.email = ["kelly@kelredd.com"]
11
+ s.homepage = "http://github.com/kelredd/pruview"
12
+ s.summary = %q{Ease generating image previews (thumbnails) of various files}
13
+ s.description = %q{Ease generating image previews (thumbnails) of various files}
14
+
15
+ s.files = `git ls-files`.split("\n")
16
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
17
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
18
+ s.require_paths = ["lib"]
19
+
20
+ s.add_development_dependency("bundler", ["~> 1.0"])
21
+ s.add_development_dependency("test-belt", ["~> 1.0"])
22
+ s.add_development_dependency(%q<shoulda>, [">= 2.10.0"])
23
+ s.add_development_dependency(%q<leftright>, [">= 0.0.6"])
24
+ s.add_development_dependency(%q<kelredd-useful>, [">= 0.4.0"])
25
+ s.add_dependency(%q<mini_magick>, ["~> 3.0"])
26
+ s.add_dependency(%q<flvtool2>, [">= 0"])
27
+ end
@@ -1,13 +1,3 @@
1
1
  module Pruview
2
- module Version
3
-
4
- MAJOR = 0
5
- MINOR = 2
6
- TINY = 2
7
-
8
- def self.to_s # :nodoc:
9
- [MAJOR, MINOR, TINY].join('.')
10
- end
11
-
12
- end
13
- end
2
+ VERSION = "0.2.3"
3
+ end
data/lib/pruview/video.rb CHANGED
@@ -63,10 +63,14 @@ module Pruview
63
63
  end
64
64
 
65
65
  def get_info(yml_path)
66
- run("#{FFYML} #{@source} #{yml_path}", "Unable to get video info")
66
+ run(info_command(@source, yml_path), "Unable to get video info")
67
67
  YAML.load_file(yml_path)
68
68
  end
69
69
 
70
+ def info_command(source, yml_path)
71
+ %Q{#{FFYML} "#{source}" "#{yml_path}"}
72
+ end
73
+
70
74
  def build_command(source, target, width, height, info, scale_static)
71
75
  command = "#{FFMPEG} -i #{source}"
72
76
  command += get_scale_command(info['width'], info['height'], width, height, scale_static)
@@ -28,7 +28,7 @@ module Pruview
28
28
  end
29
29
 
30
30
  def self.build_command(source, time_str, format, target)
31
- command = "#{Video::FFMPEG} -i #{source}"
31
+ command = %Q{#{Video::FFMPEG} -i "#{source}"}
32
32
  command += " #{time_str}"
33
33
  command += " -f #{format}" if !format.empty?
34
34
  command += " -an -y #{target}"
@@ -39,4 +39,4 @@ module Pruview
39
39
  end
40
40
 
41
41
  end
42
- end
42
+ end
@@ -23,6 +23,12 @@ module Pruview
23
23
  assert_equal '.jpg', File.extname(@output)
24
24
  end
25
25
 
26
+ should "quote the source path in #build_command" do
27
+ source = 'foo bar.jpg'
28
+ command = Pruview::VideoImage.build_command(source, 'a', 'b', 'c')
29
+ assert_equal 'ffmpeg -i "foo bar.jpg" a -f b -an -y c', command
30
+ end
31
+
26
32
  end
27
33
 
28
34
  end
@@ -39,6 +39,11 @@ module Pruview
39
39
  assert_equal '.jpg', File.extname(@output)
40
40
  end
41
41
 
42
+ should "quote the source and yml_path args to the ffyml command" do
43
+ command = @file.send(:info_command, 'foo bar.jpg', 'foo bar.yml')
44
+ assert_equal %Q{#{Pruview::Video::FFYML} "foo bar.jpg" "foo bar.yml"}, command
45
+ end
46
+
42
47
  end
43
48
 
44
49
  end
metadata CHANGED
@@ -1,27 +1,54 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kelredd-pruview
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
5
- prerelease: false
4
+ hash: 17
5
+ prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 2
10
- version: 0.2.2
9
+ - 3
10
+ version: 0.2.3
11
11
  platform: ruby
12
12
  authors:
13
- - Kelly Redding
13
+ - Kelly D. Redding
14
14
  autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-10-28 00:00:00 -05:00
19
- default_executable:
18
+ date: 2011-07-20 00:00:00 Z
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
22
- name: shoulda
23
- prerelease: false
24
21
  requirement: &id001 !ruby/object:Gem::Requirement
22
+ none: false
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ hash: 15
27
+ segments:
28
+ - 1
29
+ - 0
30
+ version: "1.0"
31
+ version_requirements: *id001
32
+ prerelease: false
33
+ name: bundler
34
+ type: :development
35
+ - !ruby/object:Gem::Dependency
36
+ requirement: &id002 !ruby/object:Gem::Requirement
37
+ none: false
38
+ requirements:
39
+ - - ~>
40
+ - !ruby/object:Gem::Version
41
+ hash: 15
42
+ segments:
43
+ - 1
44
+ - 0
45
+ version: "1.0"
46
+ version_requirements: *id002
47
+ prerelease: false
48
+ name: test-belt
49
+ type: :development
50
+ - !ruby/object:Gem::Dependency
51
+ requirement: &id003 !ruby/object:Gem::Requirement
25
52
  none: false
26
53
  requirements:
27
54
  - - ">="
@@ -32,12 +59,12 @@ dependencies:
32
59
  - 10
33
60
  - 0
34
61
  version: 2.10.0
62
+ version_requirements: *id003
63
+ prerelease: false
64
+ name: shoulda
35
65
  type: :development
36
- version_requirements: *id001
37
66
  - !ruby/object:Gem::Dependency
38
- name: leftright
39
- prerelease: false
40
- requirement: &id002 !ruby/object:Gem::Requirement
67
+ requirement: &id004 !ruby/object:Gem::Requirement
41
68
  none: false
42
69
  requirements:
43
70
  - - ">="
@@ -48,12 +75,12 @@ dependencies:
48
75
  - 0
49
76
  - 6
50
77
  version: 0.0.6
78
+ version_requirements: *id004
79
+ prerelease: false
80
+ name: leftright
51
81
  type: :development
52
- version_requirements: *id002
53
82
  - !ruby/object:Gem::Dependency
54
- name: kelredd-useful
55
- prerelease: false
56
- requirement: &id003 !ruby/object:Gem::Requirement
83
+ requirement: &id005 !ruby/object:Gem::Requirement
57
84
  none: false
58
85
  requirements:
59
86
  - - ">="
@@ -64,28 +91,12 @@ dependencies:
64
91
  - 4
65
92
  - 0
66
93
  version: 0.4.0
67
- type: :development
68
- version_requirements: *id003
69
- - !ruby/object:Gem::Dependency
70
- name: kelredd-simple-gem
94
+ version_requirements: *id005
71
95
  prerelease: false
72
- requirement: &id004 !ruby/object:Gem::Requirement
73
- none: false
74
- requirements:
75
- - - ">="
76
- - !ruby/object:Gem::Version
77
- hash: 3
78
- segments:
79
- - 0
80
- - 7
81
- - 0
82
- version: 0.7.0
96
+ name: kelredd-useful
83
97
  type: :development
84
- version_requirements: *id004
85
98
  - !ruby/object:Gem::Dependency
86
- name: mini_magick
87
- prerelease: false
88
- requirement: &id005 !ruby/object:Gem::Requirement
99
+ requirement: &id006 !ruby/object:Gem::Requirement
89
100
  none: false
90
101
  requirements:
91
102
  - - ~>
@@ -95,12 +106,12 @@ dependencies:
95
106
  - 3
96
107
  - 0
97
108
  version: "3.0"
109
+ version_requirements: *id006
110
+ prerelease: false
111
+ name: mini_magick
98
112
  type: :runtime
99
- version_requirements: *id005
100
113
  - !ruby/object:Gem::Dependency
101
- name: flvtool2
102
- prerelease: false
103
- requirement: &id006 !ruby/object:Gem::Requirement
114
+ requirement: &id007 !ruby/object:Gem::Requirement
104
115
  none: false
105
116
  requirements:
106
117
  - - ">="
@@ -109,28 +120,35 @@ dependencies:
109
120
  segments:
110
121
  - 0
111
122
  version: "0"
123
+ version_requirements: *id007
124
+ prerelease: false
125
+ name: flvtool2
112
126
  type: :runtime
113
- version_requirements: *id006
114
- description:
115
- email: kelly@kelredd.com
116
- executables: []
117
-
127
+ description: Ease generating image previews (thumbnails) of various files
128
+ email:
129
+ - kelly@kelredd.com
130
+ executables:
131
+ - ffyml
118
132
  extensions: []
119
133
 
120
- extra_rdoc_files:
121
- - README.rdoc
134
+ extra_rdoc_files: []
135
+
122
136
  files:
137
+ - .gitignore
138
+ - Gemfile
139
+ - Gemfile.lock
123
140
  - README.rdoc
124
141
  - Rakefile
125
142
  - bin/ffyml
143
+ - kelredd-pruview.gemspec
144
+ - lib/pruview.rb
145
+ - lib/pruview/USWebCoatedSWOP.icc
126
146
  - lib/pruview/document.rb
127
147
  - lib/pruview/exceptions.rb
128
148
  - lib/pruview/sRGB.icm
129
- - lib/pruview/USWebCoatedSWOP.icc
130
149
  - lib/pruview/version.rb
131
150
  - lib/pruview/video.rb
132
151
  - lib/pruview/video_image.rb
133
- - lib/pruview.rb
134
152
  - test/files/basic.jpg
135
153
  - test/files/basic.mpg
136
154
  - test/files/error.jpg
@@ -141,14 +159,12 @@ files:
141
159
  - test/unit/document_test.rb
142
160
  - test/unit/video_image_test.rb
143
161
  - test/unit/video_test.rb
144
- has_rdoc: true
145
162
  homepage: http://github.com/kelredd/pruview
146
163
  licenses: []
147
164
 
148
165
  post_install_message:
149
- rdoc_options:
150
- - --main
151
- - README.rdoc
166
+ rdoc_options: []
167
+
152
168
  require_paths:
153
169
  - lib
154
170
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -172,9 +188,18 @@ required_rubygems_version: !ruby/object:Gem::Requirement
172
188
  requirements: []
173
189
 
174
190
  rubyforge_project:
175
- rubygems_version: 1.3.7
191
+ rubygems_version: 1.7.2
176
192
  signing_key:
177
193
  specification_version: 3
178
- summary: A gem to ease generating image previews (thumbnails) of various files
179
- test_files: []
180
-
194
+ summary: Ease generating image previews (thumbnails) of various files
195
+ test_files:
196
+ - test/files/basic.jpg
197
+ - test/files/basic.mpg
198
+ - test/files/error.jpg
199
+ - test/files/error.mov
200
+ - test/files/image.tiff
201
+ - test/files/invalid_format.poop
202
+ - test/helper.rb
203
+ - test/unit/document_test.rb
204
+ - test/unit/video_image_test.rb
205
+ - test/unit/video_test.rb