mxfinfo 0.0.3.3 → 0.0.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,25 @@
1
+ class String
2
+ # returns the string enclosed in double quotes.
3
+ # all characters in the string that could be harmful will be escaped.
4
+ #
5
+ # e.g.
6
+ # 'test'.shell_escape_double_quotes # => "test"
7
+ # '$\\'"`'.shell_escape_double_quotes # => "\$\\'\"\`"
8
+ #
9
+ # This should work in al POSIX compatible shells.
10
+ #
11
+ # see: http://www.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html#tag_02_02_03
12
+ def shell_escape_double_quotes
13
+ '"'+gsub(/\\|"|\$|`/, '\\\\\0')+'"'
14
+ end unless method_defined?(:shell_escape_double_quotes)
15
+
16
+ # stolen from active_support/inflector
17
+ # TODO require "active_support/core_ext/string/inflections" when 3.0 is released
18
+ def underscore
19
+ gsub(/::/, '/').
20
+ gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
21
+ gsub(/([a-z\d])([A-Z])/,'\1_\2').
22
+ tr("-", "_").
23
+ downcase
24
+ end unless method_defined?(:underscore)
25
+ end
@@ -1,3 +1,3 @@
1
1
  class MXFinfo
2
- VERSION = "0.0.3.3"
2
+ VERSION = "0.0.3.4"
3
3
  end
data/lib/mxfinfo.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  require "forwardable"
2
- require "mxfinfo/version"
3
- require "mxfinfo/attr_readers"
2
+ require File.join(File.dirname(__FILE__),"mxfinfo/version")
3
+ require File.join(File.dirname(__FILE__),"mxfinfo/attr_readers")
4
+ require File.join(File.dirname(__FILE__),"mxfinfo/string")
4
5
 
5
6
  class MXFinfo
6
7
  extend Forwardable
@@ -43,17 +44,15 @@ class MXFinfo
43
44
  if process
44
45
  @filepath = File.absolute_path(input)
45
46
  File.exists?(@filepath) ? @valid = true : @valid = false
46
- if @valid
47
- @mxfinfo = mxfinfo
48
- # Check if output contains error from binary
49
- @mxfinfo.include?("ERROR") ? @valid = false : @valid = true
50
- @mxfinfo.include?("Failed to open file") ? @valid = false : @valid = true
51
- @mxfinfo.include?("mxf_disk_file_open_read") ? @valid = false : @valid = true
52
- end
47
+ @mxfinfo = mxfinfo if @valid
53
48
  else
54
49
  @valid = true
55
50
  @mxfinfo = input
56
51
  end
52
+ # Check if output contains error from binary
53
+ @mxfinfo.include?("ERROR") ? @valid = false : @valid = true
54
+ @mxfinfo.include?("Failed to open file") ? @valid = false : @valid = true
55
+ @mxfinfo.include?("mxf_disk_file_open_read") ? @valid = false : @valid = true
57
56
  process_data if @valid
58
57
  end
59
58
 
@@ -0,0 +1,10 @@
1
+ require 'spec_helper'
2
+
3
+ describe "ALERT01.ERROR.info" do
4
+
5
+ it "should return an invalid MXF file" do
6
+ infoFile = File.open(name_to_fixture "ALERT01.ERROR.info")
7
+ @info = MXFinfo.import(infoFile.read)
8
+ @info.valid?.should == false
9
+ end
10
+ end
@@ -0,0 +1,8 @@
1
+ 'mxf_disk_file_open_read(filename, &mxfFile)' failed in avid_mxf_info.c, line 525
2
+ Failed to open file (Beep)
3
+ 'mxf_disk_file_open_read(filename, &mxfFile)' failed in avid_mxf_info.c, line 525
4
+ Failed to open file (AlertA01.4F8564F8563B3.mxf)
5
+
6
+ Filename = Beep
7
+
8
+ Filename = AlertA01.4F8564F8563B3.mxf
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.3.3
4
+ version: 0.0.3.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -26,8 +26,11 @@ files:
26
26
  - Rakefile
27
27
  - lib/mxfinfo.rb
28
28
  - lib/mxfinfo/attr_readers.rb
29
+ - lib/mxfinfo/string.rb
29
30
  - lib/mxfinfo/version.rb
30
31
  - mxfinfo.gemspec
32
+ - spec/alert_error_spec.rb
33
+ - spec/fixtures/ALERT01.ERROR.info
31
34
  - spec/fixtures/IMG_0395.MOV.A14DC7130D.mxf
32
35
  - spec/fixtures/IMG_0395.MOV.A14DC7130D.mxf.info
33
36
  - spec/fixtures/InvalidFileTest.mxf
@@ -71,6 +74,8 @@ specification_version: 3
71
74
  summary: MXFinfo is a gem to use avidmxfinfo from http://ingex.sourceforge.net/ directly
72
75
  in ruby.
73
76
  test_files:
77
+ - spec/alert_error_spec.rb
78
+ - spec/fixtures/ALERT01.ERROR.info
74
79
  - spec/fixtures/IMG_0395.MOV.A14DC7130D.mxf
75
80
  - spec/fixtures/IMG_0395.MOV.A14DC7130D.mxf.info
76
81
  - spec/fixtures/InvalidFileTest.mxf