mediainfo 0.7.2 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +16 -0
- data/.rspec +3 -0
- data/Changelog +19 -3
- data/GemFile +5 -0
- data/LICENSE +5 -14
- data/README.md +140 -0
- data/Rakefile +4 -61
- data/lib/attribute_standardization_rules.yml +18 -0
- data/lib/mediainfo.rb +85 -497
- data/lib/mediainfo/errors.rb +14 -0
- data/lib/mediainfo/string.rb +0 -10
- data/lib/mediainfo/tracks.rb +172 -0
- data/lib/mediainfo/version.rb +3 -0
- data/mediainfo.gemspec +22 -19
- metadata +96 -69
- data/Manifest +0 -10
- data/README.markdown +0 -84
- data/index.html.template +0 -9
- data/lib/mediainfo/attr_readers.rb +0 -75
- data/test/mediainfo_awaywego_test.rb +0 -284
- data/test/mediainfo_broken_embraces_test.rb +0 -264
- data/test/mediainfo_dinner_test.rb +0 -262
- data/test/mediainfo_hats_test.rb +0 -254
- data/test/mediainfo_multiple_streams_test.rb +0 -526
- data/test/mediainfo_omen_image_test.rb +0 -232
- data/test/mediainfo_string_test.rb +0 -20
- data/test/mediainfo_subtilte_test.rb +0 -44
- data/test/mediainfo_test.rb +0 -152
- data/test/mediainfo_vimeo_test.rb +0 -262
- data/test/test_helper.rb +0 -19
@@ -1,232 +0,0 @@
|
|
1
|
-
require "test_helper"
|
2
|
-
require "mediainfo_test_helper"
|
3
|
-
|
4
|
-
class MediainfoOmenImageTest < ActiveSupport::TestCase
|
5
|
-
def setup
|
6
|
-
@info = mediainfo_mock "omen1976_464_0_480x336-6.jpg"
|
7
|
-
end
|
8
|
-
|
9
|
-
### GENERAL
|
10
|
-
|
11
|
-
test "image?" do
|
12
|
-
assert @info.image?
|
13
|
-
end
|
14
|
-
|
15
|
-
test "audio?" do
|
16
|
-
assert !@info.audio?
|
17
|
-
end
|
18
|
-
|
19
|
-
test "video?" do
|
20
|
-
assert !@info.video?
|
21
|
-
end
|
22
|
-
|
23
|
-
test "format" do
|
24
|
-
assert_equal "JPEG", @info.format
|
25
|
-
end
|
26
|
-
|
27
|
-
test "format profile" do
|
28
|
-
assert_nil @info.format_profile
|
29
|
-
end
|
30
|
-
|
31
|
-
test "codec id" do
|
32
|
-
assert_nil @info.codec_id
|
33
|
-
end
|
34
|
-
|
35
|
-
mediainfo_test_size
|
36
|
-
|
37
|
-
test "duration" do
|
38
|
-
assert_nil @info.duration
|
39
|
-
end
|
40
|
-
|
41
|
-
test "overall bitrate" do
|
42
|
-
assert_nil @info.overall_bit_rate
|
43
|
-
end
|
44
|
-
|
45
|
-
test "encoded date" do
|
46
|
-
assert_nil @info.encoded_date
|
47
|
-
end
|
48
|
-
|
49
|
-
test "tagged date" do
|
50
|
-
assert_nil @info.tagged_date
|
51
|
-
end
|
52
|
-
|
53
|
-
test "writing application" do
|
54
|
-
assert_nil @info.writing_application
|
55
|
-
end
|
56
|
-
|
57
|
-
test "writing library" do
|
58
|
-
assert_nil @info.writing_library
|
59
|
-
end
|
60
|
-
|
61
|
-
### VIDEO
|
62
|
-
=begin
|
63
|
-
test "video Format" do
|
64
|
-
assert_nil @info.video.format
|
65
|
-
end
|
66
|
-
|
67
|
-
test "video format profile" do
|
68
|
-
assert_nil @info.video.format_profile
|
69
|
-
end
|
70
|
-
|
71
|
-
test "video format settings CABAC" do
|
72
|
-
assert_nil @info.video.format_settings_cabac
|
73
|
-
end
|
74
|
-
|
75
|
-
test "video format settings ReFrames" do
|
76
|
-
assert_nil @info.video.format_settings_cabac
|
77
|
-
end
|
78
|
-
|
79
|
-
test "video Codec ID" do
|
80
|
-
assert_nil @info.video.codec_id
|
81
|
-
end
|
82
|
-
|
83
|
-
test "video Duration" do
|
84
|
-
assert_nil @info.video.duration
|
85
|
-
end
|
86
|
-
|
87
|
-
test "video Bit rate" do
|
88
|
-
assert_nil @info.video.bit_rate
|
89
|
-
end
|
90
|
-
|
91
|
-
test "video bit rate mode" do
|
92
|
-
assert_nil @info.video.bit_rate_mode
|
93
|
-
end
|
94
|
-
|
95
|
-
test "frame size" do
|
96
|
-
assert_equal "480x336", @info.frame_size
|
97
|
-
end
|
98
|
-
|
99
|
-
test "video Width" do
|
100
|
-
assert_nil @info.video.width
|
101
|
-
end
|
102
|
-
|
103
|
-
test "video Height" do
|
104
|
-
assert_nil @info.video.height
|
105
|
-
end
|
106
|
-
|
107
|
-
test "video Display aspect ratio" do
|
108
|
-
assert_nil @info.video.display_aspect_ratio
|
109
|
-
assert_nil @info.display_aspect_ratio
|
110
|
-
end
|
111
|
-
|
112
|
-
test "video Frame rate" do
|
113
|
-
assert_nil @info.video.frame_rate
|
114
|
-
assert_nil @info.fps
|
115
|
-
assert_nil @info.framerate
|
116
|
-
end
|
117
|
-
|
118
|
-
test "video frame rate mode" do
|
119
|
-
assert_nil @info.video.frame_rate_mode
|
120
|
-
end
|
121
|
-
|
122
|
-
test "video Resolution" do
|
123
|
-
assert_nil @info.video.resolution
|
124
|
-
end
|
125
|
-
|
126
|
-
test "video colorimetry" do
|
127
|
-
assert_nil @info.video.colorimetry
|
128
|
-
assert_nil @info.video.colorspace
|
129
|
-
end
|
130
|
-
|
131
|
-
test "video Scan type" do
|
132
|
-
assert_nil @info.video.scan_type
|
133
|
-
assert !@info.interlaced?
|
134
|
-
assert !@info.progressive?
|
135
|
-
end
|
136
|
-
|
137
|
-
test "video Bits/(Pixel*Frame)" do
|
138
|
-
assert_nil @info.video.bits_pixel_frame
|
139
|
-
end
|
140
|
-
|
141
|
-
test "video Stream size" do
|
142
|
-
assert_nil @info.video.stream_size
|
143
|
-
end
|
144
|
-
|
145
|
-
### AUDIO
|
146
|
-
|
147
|
-
test "audio Format" do
|
148
|
-
assert_nil @info.audio.format
|
149
|
-
end
|
150
|
-
|
151
|
-
test "audio Format settings, Endianness" do
|
152
|
-
assert_nil @info.audio.format_settings_endianness
|
153
|
-
end
|
154
|
-
|
155
|
-
test "audio Format settings, Sign" do
|
156
|
-
assert_nil @info.audio.format_settings_sign
|
157
|
-
end
|
158
|
-
|
159
|
-
test "audio Codec ID" do
|
160
|
-
assert_nil @info.audio.codec_id
|
161
|
-
end
|
162
|
-
|
163
|
-
test "audio Codec ID/Info" do
|
164
|
-
assert_nil @info.audio.codec_info
|
165
|
-
end
|
166
|
-
|
167
|
-
test "audio Duration" do
|
168
|
-
assert_nil @info.audio.duration
|
169
|
-
end
|
170
|
-
|
171
|
-
test "audio Bit rate mode" do
|
172
|
-
assert_nil @info.audio.bit_rate_mode
|
173
|
-
end
|
174
|
-
|
175
|
-
test "audio Bit rate" do
|
176
|
-
assert_nil @info.audio.bit_rate
|
177
|
-
end
|
178
|
-
|
179
|
-
test "audio Channel(s)" do
|
180
|
-
assert_nil @info.audio.channels
|
181
|
-
end
|
182
|
-
|
183
|
-
test "stereo?" do
|
184
|
-
assert !@info.stereo?
|
185
|
-
end
|
186
|
-
|
187
|
-
test "mono?" do
|
188
|
-
assert !@info.mono?
|
189
|
-
end
|
190
|
-
|
191
|
-
test "audio Sampling rate" do
|
192
|
-
assert_nil @info.audio.sampling_rate
|
193
|
-
end
|
194
|
-
|
195
|
-
test "audio Resolution" do
|
196
|
-
assert_nil @info.audio.resolution
|
197
|
-
end
|
198
|
-
|
199
|
-
test "audio Stream size" do
|
200
|
-
assert_nil @info.audio.stream_size
|
201
|
-
end
|
202
|
-
|
203
|
-
test "audio Interleave, duration" do
|
204
|
-
assert_nil @info.audio.interleave_duration
|
205
|
-
end
|
206
|
-
|
207
|
-
test "audio encoded date" do
|
208
|
-
assert_nil @info.audio.encoded_date
|
209
|
-
end
|
210
|
-
|
211
|
-
test "audio tagged date" do
|
212
|
-
assert_nil @info.audio.tagged_date
|
213
|
-
end
|
214
|
-
=end
|
215
|
-
### IMAGE
|
216
|
-
|
217
|
-
test "image format" do
|
218
|
-
assert_equal "JPEG", @info.image.format
|
219
|
-
end
|
220
|
-
|
221
|
-
test "image width" do
|
222
|
-
assert_equal 480, @info.image.width
|
223
|
-
end
|
224
|
-
|
225
|
-
test "image height" do
|
226
|
-
assert_equal 336, @info.image.height
|
227
|
-
end
|
228
|
-
|
229
|
-
test "image resolution" do
|
230
|
-
assert_equal "24 bits", @info.image.resolution
|
231
|
-
end
|
232
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
require "test_helper"
|
2
|
-
require "mediainfo_test_helper"
|
3
|
-
|
4
|
-
class MediainfoStringTest < ActiveSupport::TestCase
|
5
|
-
test "escaping slashes" do
|
6
|
-
assert_equal '"foo\\\bar"', 'foo\bar'.shell_escape_double_quotes
|
7
|
-
end
|
8
|
-
|
9
|
-
test "escaping quotes" do
|
10
|
-
assert_equal '"foo\"bar"', 'foo"bar'.shell_escape_double_quotes
|
11
|
-
end
|
12
|
-
|
13
|
-
test "escaping ticks" do
|
14
|
-
assert_equal '"foo\`bar"', 'foo`bar'.shell_escape_double_quotes
|
15
|
-
end
|
16
|
-
|
17
|
-
test "escaping dollar signs" do
|
18
|
-
assert_equal '"foo\$bar"', 'foo$bar'.shell_escape_double_quotes
|
19
|
-
end
|
20
|
-
end
|
@@ -1,44 +0,0 @@
|
|
1
|
-
require "test_helper"
|
2
|
-
require "mediainfo_test_helper"
|
3
|
-
|
4
|
-
class MediainfoSubtitleTest < ActiveSupport::TestCase
|
5
|
-
def setup
|
6
|
-
@info = mediainfo_mock "subtitle"
|
7
|
-
end
|
8
|
-
|
9
|
-
test 'text streams count' do
|
10
|
-
assert_equal 4, @info.text.count
|
11
|
-
end
|
12
|
-
|
13
|
-
test "text 1 stream id" do
|
14
|
-
assert_equal "1", @info.text[0].stream_id
|
15
|
-
end
|
16
|
-
|
17
|
-
test "text 1 Format" do
|
18
|
-
assert_equal "ASS", @info.text[0].format
|
19
|
-
end
|
20
|
-
|
21
|
-
test "text 1 Codec ID" do
|
22
|
-
assert_equal "S_TEXT/ASS", @info.text[0].codec_id
|
23
|
-
end
|
24
|
-
|
25
|
-
test "text 1 Codec ID info" do
|
26
|
-
#assert_equal "Advanced Sub Station Alpha", @info.text[0].codec_id_info
|
27
|
-
end
|
28
|
-
|
29
|
-
test "text 2 stream id" do
|
30
|
-
assert_equal "2", @info.text[1].stream_id
|
31
|
-
end
|
32
|
-
|
33
|
-
test "text 1 Format" do
|
34
|
-
assert_equal "SSA", @info.text[1].format
|
35
|
-
end
|
36
|
-
|
37
|
-
test "text 1 Codec ID" do
|
38
|
-
assert_equal "S_TEXT/SSA", @info.text[1].codec_id
|
39
|
-
end
|
40
|
-
|
41
|
-
test "text 1 Codec ID info" do
|
42
|
-
#assert_equal "Sub Station Alpha", @info.text[1].codec_id_info
|
43
|
-
end
|
44
|
-
end
|
data/test/mediainfo_test.rb
DELETED
@@ -1,152 +0,0 @@
|
|
1
|
-
require "test_helper"
|
2
|
-
require "mediainfo_test_helper"
|
3
|
-
|
4
|
-
class MediainfoTest < ActiveSupport::TestCase
|
5
|
-
supported_attributes = [
|
6
|
-
:codec_id,
|
7
|
-
:duration,
|
8
|
-
:format,
|
9
|
-
:format_profile,
|
10
|
-
:format_info,
|
11
|
-
:overall_bit_rate,
|
12
|
-
:writing_application,
|
13
|
-
:writing_library,
|
14
|
-
|
15
|
-
:mastered_date,
|
16
|
-
:tagged_date,
|
17
|
-
:encoded_date,
|
18
|
-
|
19
|
-
### VIDEO
|
20
|
-
|
21
|
-
:video_stream_id,
|
22
|
-
:video_duration,
|
23
|
-
:video_stream_size,
|
24
|
-
:video_bit_rate,
|
25
|
-
:video_nominal_bit_rate,
|
26
|
-
:video_bit_rate_mode,
|
27
|
-
:video_scan_order,
|
28
|
-
:video_scan_type,
|
29
|
-
:video_resolution,
|
30
|
-
:video_colorimetry,
|
31
|
-
:video_standard,
|
32
|
-
:video_format,
|
33
|
-
:video_format_info,
|
34
|
-
:video_format_profile,
|
35
|
-
:video_format_version,
|
36
|
-
:video_format_settings_cabac,
|
37
|
-
:video_format_settings_reframes,
|
38
|
-
:video_format_settings_matrix,
|
39
|
-
:video_codec_id,
|
40
|
-
:video_codec_info,
|
41
|
-
:video_frame_rate,
|
42
|
-
:video_minimum_frame_rate,
|
43
|
-
:video_maximum_frame_rate,
|
44
|
-
:video_frame_rate_mode,
|
45
|
-
:video_display_aspect_ratio,
|
46
|
-
:video_bits_pixel_frame,
|
47
|
-
:video_width,
|
48
|
-
:video_height,
|
49
|
-
:video_encoded_date,
|
50
|
-
:video_tagged_date,
|
51
|
-
:video_color_primaries,
|
52
|
-
:video_transfer_characteristics,
|
53
|
-
:video_matrix_coefficients,
|
54
|
-
|
55
|
-
### AUDIO
|
56
|
-
|
57
|
-
:audio_stream_id,
|
58
|
-
:audio_sampling_rate,
|
59
|
-
:audio_duration,
|
60
|
-
:audio_stream_size,
|
61
|
-
:audio_bit_rate,
|
62
|
-
:audio_bit_rate_mode,
|
63
|
-
:audio_interleave_duration,
|
64
|
-
:audio_resolution,
|
65
|
-
:audio_format,
|
66
|
-
:audio_format_info,
|
67
|
-
:audio_format_profile,
|
68
|
-
:audio_format_settings_endianness,
|
69
|
-
:audio_format_settings_sign,
|
70
|
-
:audio_format_settings_sbr,
|
71
|
-
:audio_format_version,
|
72
|
-
:audio_codec_id,
|
73
|
-
:audio_codec_id_hint,
|
74
|
-
:audio_codec_info,
|
75
|
-
:audio_channel_positions,
|
76
|
-
:audio_channels,
|
77
|
-
:audio_encoded_date,
|
78
|
-
:audio_tagged_date,
|
79
|
-
|
80
|
-
### IMAGE
|
81
|
-
|
82
|
-
:image_resolution,
|
83
|
-
:image_format,
|
84
|
-
|
85
|
-
:image_width,
|
86
|
-
:image_height,
|
87
|
-
|
88
|
-
### MENU
|
89
|
-
|
90
|
-
:menu_stream_id,
|
91
|
-
:menu_tagged_date,
|
92
|
-
:menu_encoded_date,
|
93
|
-
:menu_delay,
|
94
|
-
|
95
|
-
### TEXT
|
96
|
-
:text_codec_id,
|
97
|
-
:text_codec_info,
|
98
|
-
:text_format,
|
99
|
-
:text_stream_id
|
100
|
-
]
|
101
|
-
|
102
|
-
Mediainfo.supported_attributes.each do |attribute|
|
103
|
-
test "supports #{attribute} attribute" do
|
104
|
-
assert supported_attributes.include?(attribute),
|
105
|
-
"#{attribute} is not supported"
|
106
|
-
end
|
107
|
-
end
|
108
|
-
|
109
|
-
def setup
|
110
|
-
Mediainfo.default_mediainfo_path!
|
111
|
-
end
|
112
|
-
|
113
|
-
test "retains last system command generated" do
|
114
|
-
p = File.expand_path "./test/fixtures/dinner.3g2.xml"
|
115
|
-
m = Mediainfo.new p
|
116
|
-
assert_equal "mediainfo \"#{p}\" --Output=XML", m.last_command
|
117
|
-
end
|
118
|
-
|
119
|
-
test "allows customization of path to mediainfo binary" do
|
120
|
-
Mediainfo.any_instance.stubs(:run_command!).returns("test")
|
121
|
-
|
122
|
-
assert_equal "mediainfo", Mediainfo.path
|
123
|
-
|
124
|
-
m = Mediainfo.new "/dev/null"
|
125
|
-
assert_equal "mediainfo \"/dev/null\" --Output=XML", m.last_command
|
126
|
-
|
127
|
-
Mediainfo.any_instance.stubs(:mediainfo_version).returns("0.7.25")
|
128
|
-
|
129
|
-
Mediainfo.path = "/opt/local/bin/mediainfo"
|
130
|
-
assert_equal "/opt/local/bin/mediainfo", Mediainfo.path
|
131
|
-
|
132
|
-
m = Mediainfo.new "/dev/null"
|
133
|
-
assert_equal "/opt/local/bin/mediainfo \"/dev/null\" --Output=XML", m.last_command
|
134
|
-
end
|
135
|
-
|
136
|
-
test "can be initialized with a raw response" do
|
137
|
-
m = Mediainfo.new
|
138
|
-
m.raw_response = mediainfo_fixture("AwayWeGo_24fps.mov")
|
139
|
-
assert m.video?
|
140
|
-
assert m.audio?
|
141
|
-
end
|
142
|
-
|
143
|
-
test "cannot be initialized with version < 0.7.25" do
|
144
|
-
Mediainfo.any_instance.stubs(:mediainfo_version).returns("0.7.10")
|
145
|
-
assert_raises(Mediainfo::IncompatibleVersionError) { Mediainfo.new }
|
146
|
-
end
|
147
|
-
|
148
|
-
test "fails obviously when CLI is not installed" do
|
149
|
-
Mediainfo.any_instance.stubs(:mediainfo_version).returns(nil)
|
150
|
-
assert_raises(Mediainfo::UnknownVersionError) { Mediainfo.new }
|
151
|
-
end
|
152
|
-
end
|