mxfinfo 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,3 @@
1
1
  class MXFinfo
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
data/lib/mxfinfo.rb CHANGED
@@ -32,8 +32,12 @@ class MXFinfo
32
32
  def initialize(input, process = true)
33
33
  if process
34
34
  @filepath = File.absolute_path(input)
35
- File.exists?(@filepath.shellescape) ? @valid = true : @valid = false
36
- @mxfinfo = mxfinfo if (process && @valid)
35
+ File.exists?(@filepath) ? @valid = true : @valid = false
36
+ if @valid
37
+ @mxfinfo = mxfinfo
38
+ # Check if output contains error from binary
39
+ @mxfinfo.include?("ERROR") ? @valid = false : @valid = true
40
+ end
37
41
  else
38
42
  @valid = true
39
43
  @mxfinfo = input
@@ -95,7 +99,7 @@ class MXFinfo
95
99
  private
96
100
  def mxfinfo
97
101
  # TODO: - add check if return data is valid
98
- `#{MXFinfo.binary} #{@filepath.shellescape}`
102
+ `#{MXFinfo.binary} #{@filepath.shellescape} 2>&1`
99
103
  end
100
104
 
101
105
  def process_data
File without changes
data/spec/mxfinfo_spec.rb CHANGED
@@ -27,6 +27,15 @@ describe MXFinfo do
27
27
  MXFinfo.scan("imagenary File").should == nil
28
28
  end
29
29
 
30
+ #it "should work with whitespace filenames" do
31
+ # MXFinfo.scan(name_to_fixture "Shellescape Test.mxf").should_not == nil
32
+ #end
33
+
34
+ it "should redirect stderr to stdout and return if ERROR is included" do
35
+ info = MXFinfo.scan(name_to_fixture "InvalidFileTest.mxf")
36
+ info.should == nil
37
+ end
38
+
30
39
  it "should be possible to access raw data" do
31
40
  info = MXFinfo.scan(name_to_fixture "IMG_0395.MOV.A14DC7130D.mxf")
32
41
  info.nil?.should == false
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mxfinfo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -30,6 +30,7 @@ files:
30
30
  - mxfinfo.gemspec
31
31
  - spec/fixtures/IMG_0395.MOV.A14DC7130D.mxf
32
32
  - spec/fixtures/IMG_0395.MOV.A14DC7130D.mxf.info
33
+ - spec/fixtures/InvalidFileTest.mxf
33
34
  - spec/img_0395.mov.a14dc7130d_spec.rb
34
35
  - spec/mxfinfo_spec.rb
35
36
  - spec/spec_helper.rb
@@ -61,6 +62,7 @@ summary: MXFinfo is a gem to use avidmxfinfo from http://ingex.sourceforge.net/
61
62
  test_files:
62
63
  - spec/fixtures/IMG_0395.MOV.A14DC7130D.mxf
63
64
  - spec/fixtures/IMG_0395.MOV.A14DC7130D.mxf.info
65
+ - spec/fixtures/InvalidFileTest.mxf
64
66
  - spec/img_0395.mov.a14dc7130d_spec.rb
65
67
  - spec/mxfinfo_spec.rb
66
68
  - spec/spec_helper.rb