kelredd-pruview 0.2.3 → 0.2.4
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/Gemfile.lock +3 -10
- data/bin/ffyml +11 -11
- data/kelredd-pruview.gemspec +1 -4
- data/lib/pruview/version.rb +1 -1
- data/test/helper.rb +2 -6
- data/test/unit/document_test.rb +32 -27
- data/test/unit/video_image_test.rb +24 -21
- data/test/unit/video_test.rb +43 -40
- metadata +10 -58
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
kelredd-pruview (0.2.
|
4
|
+
kelredd-pruview (0.2.4)
|
5
5
|
flvtool2
|
6
6
|
mini_magick (~> 3.0)
|
7
7
|
|
@@ -9,16 +9,12 @@ GEM
|
|
9
9
|
remote: http://rubygems.org/
|
10
10
|
specs:
|
11
11
|
flvtool2 (1.0.6)
|
12
|
-
json (1.4.6)
|
13
|
-
kelredd-useful (0.4.2)
|
14
|
-
json
|
15
12
|
leftright (0.9.1)
|
16
13
|
mini_magick (3.2)
|
17
14
|
subexec (~> 0.0.4)
|
18
15
|
rake (0.9.2)
|
19
|
-
shoulda (2.11.3)
|
20
16
|
subexec (0.0.4)
|
21
|
-
test-belt (
|
17
|
+
test-belt (2.0.0)
|
22
18
|
leftright (~> 0.9.0)
|
23
19
|
|
24
20
|
PLATFORMS
|
@@ -27,8 +23,5 @@ PLATFORMS
|
|
27
23
|
DEPENDENCIES
|
28
24
|
bundler (~> 1.0)
|
29
25
|
kelredd-pruview!
|
30
|
-
kelredd-useful (>= 0.4.0)
|
31
|
-
leftright (>= 0.0.6)
|
32
26
|
rake
|
33
|
-
|
34
|
-
test-belt (~> 1.0)
|
27
|
+
test-belt (~> 2.0)
|
data/bin/ffyml
CHANGED
@@ -35,19 +35,19 @@ 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 -m 1 "Input #0" | gawk -F', ' '{print $2}'`
|
39
|
+
var_duration=`cat "$temp_out" | grep -m 1 "Duration:" | gawk -F': ' '{print $2}' | gawk -F', ' '{print $1}'`
|
40
|
+
var_bitrate=`cat "$temp_out" | grep -m 1 "Duration:" | gawk -F': ' '{print $4}' | gawk -F' ' '{print $1}'`
|
41
|
+
var_codec=`cat "$temp_out" | grep -m 1 "Video:" | gawk -F': ' '{print $3}' | gawk -F', ' '{print $1}'`
|
42
|
+
var_width=`cat "$temp_out" | grep -m 1 "Video:" | gawk -F': ' '{print $3}' | gawk -F', ' '{print $3}' | gawk -F'x' '{print $1}'`
|
43
|
+
var_height=`cat "$temp_out" | grep -m 1 "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 -m 1 "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 -m 1 "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 -m 1 "Audio:" | gawk -F': ' '{print $3}' | gawk -F', ' '{print $1}'`
|
49
|
+
var_audio_bitrate=`cat "$temp_out" | grep -m 1 "Audio:" | gawk -F', ' '{print $5}' | gawk -F' ' '{print $1}'`
|
50
|
+
var_audio_sampling=`cat "$temp_out" | grep -m 1 "Audio:" | gawk -F', ' '{print $2}' | gawk -F' ' '{print $1}'`
|
51
51
|
|
52
52
|
# write the output YAML file
|
53
53
|
echo "# file properties" > "$output_file"
|
data/kelredd-pruview.gemspec
CHANGED
@@ -18,10 +18,7 @@ Gem::Specification.new do |s|
|
|
18
18
|
s.require_paths = ["lib"]
|
19
19
|
|
20
20
|
s.add_development_dependency("bundler", ["~> 1.0"])
|
21
|
-
s.add_development_dependency("test-belt", ["~>
|
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"])
|
21
|
+
s.add_development_dependency("test-belt", ["~> 2.0"])
|
25
22
|
s.add_dependency(%q<mini_magick>, ["~> 3.0"])
|
26
23
|
s.add_dependency(%q<flvtool2>, [">= 0"])
|
27
24
|
end
|
data/lib/pruview/version.rb
CHANGED
data/test/helper.rb
CHANGED
@@ -1,8 +1,4 @@
|
|
1
|
-
require '
|
2
|
-
require 'test/unit'
|
3
|
-
require 'shoulda'
|
4
|
-
require 'useful/shoulda_macros/test_unit'
|
5
|
-
require 'leftright'
|
1
|
+
require 'test_belt'
|
6
2
|
|
7
3
|
# Add test and lib paths to the $LOAD_PATH
|
8
4
|
[ File.dirname(__FILE__),
|
@@ -42,4 +38,4 @@ def should_complain_about(should_statement, message_match, &block)
|
|
42
38
|
assert_match message_match, err.message
|
43
39
|
end
|
44
40
|
end
|
45
|
-
end
|
41
|
+
end
|
data/test/unit/document_test.rb
CHANGED
@@ -1,43 +1,48 @@
|
|
1
1
|
require 'test/helper'
|
2
2
|
|
3
3
|
module Pruview
|
4
|
+
|
4
5
|
class DocumentTest < Test::Unit::TestCase
|
6
|
+
include TestBelt
|
5
7
|
|
6
|
-
context "A Pruview::Document"
|
7
|
-
|
8
|
-
|
8
|
+
context "A Pruview::Document"
|
9
|
+
setup { @file = Pruview::Document.new(FILES['basic image'], OUTPUT_PATH) }
|
10
|
+
subject { @file }
|
9
11
|
|
10
|
-
|
12
|
+
should have_instance_methods :to_jpg
|
11
13
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
should_complain_about("converting invalid image formats", /not supported - file extension: .poop/) do
|
16
|
-
Pruview::Document.new(FILES['invalid format'], OUTPUT_PATH)
|
17
|
-
end
|
18
|
-
should_complain_about("converting with invalid output paths", /^Invalid target directory/) do
|
19
|
-
Pruview::Document.new(FILES['basic image'], INVALID_OUTPUT_PATH)
|
20
|
-
end
|
14
|
+
should_complain_about("converting invalid images", /^Invalid source file/) do
|
15
|
+
Pruview::Document.new(FILES['invalid image'], OUTPUT_PATH)
|
16
|
+
end
|
21
17
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
assert_equal '.jpg', File.extname(@output)
|
26
|
-
end
|
18
|
+
should_complain_about("converting invalid image formats", /not supported - file extension: .poop/) do
|
19
|
+
Pruview::Document.new(FILES['invalid format'], OUTPUT_PATH)
|
20
|
+
end
|
27
21
|
|
28
|
-
|
29
|
-
|
30
|
-
|
22
|
+
should_complain_about("converting with invalid output paths", /^Invalid target directory/) do
|
23
|
+
Pruview::Document.new(FILES['basic image'], INVALID_OUTPUT_PATH)
|
24
|
+
end
|
31
25
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
26
|
+
should "create a jpg version of itself" do
|
27
|
+
@output = @file.to_jpg('basic_image', 50, 50)
|
28
|
+
assert File.exists?(@output)
|
29
|
+
assert_equal '.jpg', File.extname(@output)
|
30
|
+
end
|
37
31
|
|
38
|
-
|
32
|
+
end
|
33
|
+
|
34
|
+
class TiffTest < DocumentTest
|
39
35
|
|
36
|
+
context "of a TIFF file"
|
37
|
+
setup { @file = Pruview::Document.new(FILES['tiff'], OUTPUT_PATH) }
|
38
|
+
subject { @file }
|
39
|
+
|
40
|
+
should "create a jpg version of itself" do
|
41
|
+
@output = @file.to_jpg('tiff', 50, 50)
|
42
|
+
assert File.exists?(@output)
|
43
|
+
assert_equal '.jpg', File.extname(@output)
|
40
44
|
end
|
41
45
|
|
42
46
|
end
|
47
|
+
|
43
48
|
end
|
@@ -1,35 +1,38 @@
|
|
1
1
|
require 'test/helper'
|
2
2
|
|
3
3
|
module Pruview
|
4
|
+
|
4
5
|
class VideoImageTest < Test::Unit::TestCase
|
6
|
+
include TestBelt
|
7
|
+
context "A Pruview::VideoImage"
|
8
|
+
subject { Pruview::VideoImage }
|
5
9
|
|
6
|
-
|
10
|
+
should have_instance_method :to_jpg
|
7
11
|
|
8
|
-
|
12
|
+
should_complain_about("converting invalid video", /^Invalid source file/) do
|
13
|
+
Pruview::VideoImage.to_jpg(FILES['invalid video'], OUTPUT_PATH, 'file')
|
14
|
+
end
|
9
15
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
should_complain_about("converting invalid video formats", /not supported - file extension: .poop/) do
|
14
|
-
Pruview::VideoImage.to_jpg(FILES['invalid format'], OUTPUT_PATH, 'file')
|
15
|
-
end
|
16
|
-
should_complain_about("converting with invalid output paths", /^Invalid target directory/) do
|
17
|
-
Pruview::VideoImage.to_jpg(FILES['basic video'], INVALID_OUTPUT_PATH, 'file')
|
18
|
-
end
|
16
|
+
should_complain_about("converting invalid video formats", /not supported - file extension: .poop/) do
|
17
|
+
Pruview::VideoImage.to_jpg(FILES['invalid format'], OUTPUT_PATH, 'file')
|
18
|
+
end
|
19
19
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
assert_equal '.jpg', File.extname(@output)
|
24
|
-
end
|
20
|
+
should_complain_about("converting with invalid output paths", /^Invalid target directory/) do
|
21
|
+
Pruview::VideoImage.to_jpg(FILES['basic video'], INVALID_OUTPUT_PATH, 'file')
|
22
|
+
end
|
25
23
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
24
|
+
should "create a jpg version of itself" do
|
25
|
+
@output = Pruview::VideoImage.to_jpg(FILES['basic video'], OUTPUT_PATH, 'file')
|
26
|
+
assert File.exists?(@output)
|
27
|
+
assert_equal '.jpg', File.extname(@output)
|
28
|
+
end
|
31
29
|
|
30
|
+
should "quote the source path in #build_command" do
|
31
|
+
source = 'foo bar.jpg'
|
32
|
+
command = Pruview::VideoImage.build_command(source, 'a', 'b', 'c')
|
33
|
+
assert_equal 'ffmpeg -i "foo bar.jpg" a -f b -an -y c', command
|
32
34
|
end
|
33
35
|
|
34
36
|
end
|
37
|
+
|
35
38
|
end
|
data/test/unit/video_test.rb
CHANGED
@@ -1,50 +1,53 @@
|
|
1
1
|
require 'test/helper'
|
2
2
|
|
3
3
|
module Pruview
|
4
|
+
|
4
5
|
class VideoTest < Test::Unit::TestCase
|
6
|
+
include TestBelt
|
7
|
+
|
8
|
+
context "A Pruview::Video"
|
9
|
+
setup { @file = Pruview::Video.new(FILES['basic video'], OUTPUT_PATH) }
|
10
|
+
subject { @file }
|
5
11
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
should_complain_about("converting invalid video", /^Invalid source file/) do
|
13
|
-
Pruview::Video.new(FILES['invalid video'], OUTPUT_PATH)
|
14
|
-
end
|
15
|
-
should_complain_about("converting invalid video formats", /not supported - file extension: .poop/) do
|
16
|
-
Pruview::Video.new(FILES['invalid format'], OUTPUT_PATH)
|
17
|
-
end
|
18
|
-
should_complain_about("converting with invalid output paths", /^Invalid target directory/) do
|
19
|
-
Pruview::Video.new(FILES['basic video'], INVALID_OUTPUT_PATH)
|
20
|
-
end
|
21
|
-
|
22
|
-
should "create a mov version of itself" do
|
23
|
-
@output = @file.to_mov('file', 50, 50)
|
24
|
-
assert File.exists?(@output)
|
25
|
-
assert_equal '.mov', File.extname(@output)
|
26
|
-
end
|
27
|
-
|
28
|
-
# too unstable to test right now
|
29
|
-
# the above test validates the plumbing and command building
|
30
|
-
#should "create an flv version of itself" do
|
31
|
-
# @output = @file.to_flv('file', 50, 50)
|
32
|
-
# assert File.exists?(@output)
|
33
|
-
# assert_equal '.flv', File.extname(@output)
|
34
|
-
#end
|
35
|
-
|
36
|
-
should "create a jpg version of itself" do
|
37
|
-
@output = @file.to_jpg('file')
|
38
|
-
assert File.exists?(@output)
|
39
|
-
assert_equal '.jpg', File.extname(@output)
|
40
|
-
end
|
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
|
12
|
+
should have_instance_methods :to_flv, :to_mov, :to_jpg, :info
|
13
|
+
|
14
|
+
should_complain_about("converting invalid video", /^Invalid source file/) do
|
15
|
+
Pruview::Video.new(FILES['invalid video'], OUTPUT_PATH)
|
16
|
+
end
|
46
17
|
|
18
|
+
should_complain_about("converting invalid video formats", /not supported - file extension: .poop/) do
|
19
|
+
Pruview::Video.new(FILES['invalid format'], OUTPUT_PATH)
|
20
|
+
end
|
21
|
+
|
22
|
+
should_complain_about("converting with invalid output paths", /^Invalid target directory/) do
|
23
|
+
Pruview::Video.new(FILES['basic video'], INVALID_OUTPUT_PATH)
|
24
|
+
end
|
25
|
+
|
26
|
+
should "create a mov version of itself" do
|
27
|
+
@output = @file.to_mov('file', 50, 50)
|
28
|
+
assert File.exists?(@output)
|
29
|
+
assert_equal '.mov', File.extname(@output)
|
30
|
+
end
|
31
|
+
|
32
|
+
# too unstable to test right now
|
33
|
+
# the above test validates the plumbing and command building
|
34
|
+
#should "create an flv version of itself" do
|
35
|
+
# @output = @file.to_flv('file', 50, 50)
|
36
|
+
# assert File.exists?(@output)
|
37
|
+
# assert_equal '.flv', File.extname(@output)
|
38
|
+
#end
|
39
|
+
|
40
|
+
should "create a jpg version of itself" do
|
41
|
+
@output = @file.to_jpg('file')
|
42
|
+
assert File.exists?(@output)
|
43
|
+
assert_equal '.jpg', File.extname(@output)
|
44
|
+
end
|
45
|
+
|
46
|
+
should "quote the source and yml_path args to the ffyml command" do
|
47
|
+
command = @file.send(:info_command, 'foo bar.jpg', 'foo bar.yml')
|
48
|
+
assert_equal %Q{#{Pruview::Video::FFYML} "foo bar.jpg" "foo bar.yml"}, command
|
47
49
|
end
|
48
50
|
|
49
51
|
end
|
52
|
+
|
50
53
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kelredd-pruview
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 31
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 4
|
10
|
+
version: 0.2.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Kelly D. Redding
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-08-02 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
requirement: &id001 !ruby/object:Gem::Requirement
|
@@ -38,65 +38,17 @@ dependencies:
|
|
38
38
|
requirements:
|
39
39
|
- - ~>
|
40
40
|
- !ruby/object:Gem::Version
|
41
|
-
hash:
|
41
|
+
hash: 3
|
42
42
|
segments:
|
43
|
-
-
|
43
|
+
- 2
|
44
44
|
- 0
|
45
|
-
version: "
|
45
|
+
version: "2.0"
|
46
46
|
version_requirements: *id002
|
47
47
|
prerelease: false
|
48
48
|
name: test-belt
|
49
49
|
type: :development
|
50
50
|
- !ruby/object:Gem::Dependency
|
51
51
|
requirement: &id003 !ruby/object:Gem::Requirement
|
52
|
-
none: false
|
53
|
-
requirements:
|
54
|
-
- - ">="
|
55
|
-
- !ruby/object:Gem::Version
|
56
|
-
hash: 39
|
57
|
-
segments:
|
58
|
-
- 2
|
59
|
-
- 10
|
60
|
-
- 0
|
61
|
-
version: 2.10.0
|
62
|
-
version_requirements: *id003
|
63
|
-
prerelease: false
|
64
|
-
name: shoulda
|
65
|
-
type: :development
|
66
|
-
- !ruby/object:Gem::Dependency
|
67
|
-
requirement: &id004 !ruby/object:Gem::Requirement
|
68
|
-
none: false
|
69
|
-
requirements:
|
70
|
-
- - ">="
|
71
|
-
- !ruby/object:Gem::Version
|
72
|
-
hash: 19
|
73
|
-
segments:
|
74
|
-
- 0
|
75
|
-
- 0
|
76
|
-
- 6
|
77
|
-
version: 0.0.6
|
78
|
-
version_requirements: *id004
|
79
|
-
prerelease: false
|
80
|
-
name: leftright
|
81
|
-
type: :development
|
82
|
-
- !ruby/object:Gem::Dependency
|
83
|
-
requirement: &id005 !ruby/object:Gem::Requirement
|
84
|
-
none: false
|
85
|
-
requirements:
|
86
|
-
- - ">="
|
87
|
-
- !ruby/object:Gem::Version
|
88
|
-
hash: 15
|
89
|
-
segments:
|
90
|
-
- 0
|
91
|
-
- 4
|
92
|
-
- 0
|
93
|
-
version: 0.4.0
|
94
|
-
version_requirements: *id005
|
95
|
-
prerelease: false
|
96
|
-
name: kelredd-useful
|
97
|
-
type: :development
|
98
|
-
- !ruby/object:Gem::Dependency
|
99
|
-
requirement: &id006 !ruby/object:Gem::Requirement
|
100
52
|
none: false
|
101
53
|
requirements:
|
102
54
|
- - ~>
|
@@ -106,12 +58,12 @@ dependencies:
|
|
106
58
|
- 3
|
107
59
|
- 0
|
108
60
|
version: "3.0"
|
109
|
-
version_requirements: *
|
61
|
+
version_requirements: *id003
|
110
62
|
prerelease: false
|
111
63
|
name: mini_magick
|
112
64
|
type: :runtime
|
113
65
|
- !ruby/object:Gem::Dependency
|
114
|
-
requirement: &
|
66
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
115
67
|
none: false
|
116
68
|
requirements:
|
117
69
|
- - ">="
|
@@ -120,7 +72,7 @@ dependencies:
|
|
120
72
|
segments:
|
121
73
|
- 0
|
122
74
|
version: "0"
|
123
|
-
version_requirements: *
|
75
|
+
version_requirements: *id004
|
124
76
|
prerelease: false
|
125
77
|
name: flvtool2
|
126
78
|
type: :runtime
|