depix 1.1.2 → 1.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,8 @@
1
+ === 1.1.3 / 2010-02-12
2
+
3
+ * Discard charfield content that comes after the first null byte (seriously, who cares?)
4
+ * Add Editor#copy_from(another_dpx)
5
+
1
6
  === 1.1.2 / 2009-12-27
2
7
 
3
8
  * Do not try to work with timecode data if it's nil
data/Manifest.txt CHANGED
@@ -1,4 +1,3 @@
1
- .DS_Store
2
1
  DPX_HEADER_STRUCTURE.txt
3
2
  History.txt
4
3
  Manifest.txt
@@ -14,12 +13,11 @@ lib/depix/enums.rb
14
13
  lib/depix/reader.rb
15
14
  lib/depix/struct_explainer.rb
16
15
  lib/depix/structs.rb
17
- test/.DS_Store
18
- test/samples/.DS_Store
19
16
  test/samples/026_FROM_HERO_TAPE_5-3-1_MOV.0029.dpx
20
17
  test/samples/E012_P001_L000002_lin.0001.dpx
21
18
  test/samples/E012_P001_L000002_lin.0002.dpx
22
19
  test/samples/E012_P001_L000002_log.0001.dpx
23
20
  test/samples/E012_P001_L000002_log.0002.dpx
21
+ test/samples/northlight_tc_mode_mismatch.dpx
24
22
  test/test_depix.rb
25
23
  test/test_dict.rb
data/Rakefile CHANGED
@@ -2,10 +2,11 @@ require 'rubygems'
2
2
  require 'hoe'
3
3
  require './lib/depix'
4
4
 
5
- Hoe.new('depix', Depix::VERSION) do |p|
5
+ Hoe.spec('depix') do |p|
6
+ p.version = Depix::VERSION
6
7
  p.developer('Julik Tarkhanov', 'me@julik.nl')
7
8
  p.rubyforge_name = 'guerilla-di'
8
- p.extra_deps << 'timecode'
9
+ p.extra_deps << ['timecode', ">=", "0.2.0"]
9
10
  p.remote_rdoc_dir = 'depix'
10
11
  end
11
12
 
data/lib/depix.rb CHANGED
@@ -10,7 +10,7 @@ require File.dirname(__FILE__) + '/depix/editor'
10
10
 
11
11
 
12
12
  module Depix
13
- VERSION = '1.1.2'
13
+ VERSION = '1.1.3'
14
14
 
15
15
  class InvalidHeader < RuntimeError; end
16
16
 
data/lib/depix/dict.rb CHANGED
@@ -232,8 +232,9 @@ module Depix
232
232
  if v == BLANK
233
233
  nil
234
234
  else
235
- 2.times { BLANKING_PATTERNS.each{|p| v.gsub!(p, '')} }
236
- v.empty? ? nil : v
235
+ # Truncate everything from the null byte up
236
+ upto_nulb = v.split(0x00.chr).shift
237
+ (upto_nulb.nil? || upto_nulb.empty?) ? nil : upto_nulb
237
238
  end
238
239
  end
239
240
 
@@ -503,6 +504,14 @@ module Depix
503
504
  options, count = (args[-1].is_a?(Hash) ? DEF_OPTS.merge(args.pop) : DEF_OPTS), (args.shift || 1)
504
505
  [count, options]
505
506
  end
507
+ end # End class methods
508
+
509
+ def []=(field, value)
510
+ send("#{field}=", value)
511
+ end
512
+
513
+ def [](field)
514
+ send(field)
506
515
  end
507
516
  end
508
517
 
data/lib/depix/editor.rb CHANGED
@@ -26,15 +26,17 @@ module Depix
26
26
  @dpx = Depix.from_file(@path)
27
27
  end
28
28
 
29
+ # Copy headers from another DPX object
30
+ def copy_from(another)
31
+ @dpx = another
32
+ end
33
+
29
34
  # Save the headers to file at path, overwriting the old ones
30
35
  def commit!
31
36
  raise "No headers" unless @dpx
32
37
  raise "Cannot pack LE headers yet" if @dpx.le?
33
38
  packed = @dpx.class.pack(@dpx)
34
39
 
35
- # Validate that we can unpack first - what if something went wrong?
36
- Depix::Reader.new.parse(packed, false)
37
-
38
40
  # Use in-place writing into DPX file (this is what + does)
39
41
  File.open(@path, 'rb+') do | f |
40
42
  f.seek(0, IO::SEEK_SET); f.write(packed)
data/test/test_depix.rb CHANGED
@@ -18,7 +18,7 @@ class ReaderTest < Test::Unit::TestCase
18
18
  assert_equal 6144, parsed.file.user_size
19
19
  assert_equal "E012_P001_L000002_lin.0001.dpx", parsed.file.filename
20
20
  assert_equal "2008:12:19:01:18:37:CEST", parsed.file.timestamp
21
- assert_equal "UTODESK", parsed.file.creator
21
+ assert_equal nil, parsed.file.creator
22
22
  assert_equal 0, parsed.image.orientation
23
23
 
24
24
  assert_equal 320, parsed.image.pixels_per_line
@@ -43,8 +43,8 @@ class ReaderTest < Test::Unit::TestCase
43
43
  assert_equal 8192, ie.data_offset
44
44
  assert_equal 0, ie.end_of_line_padding
45
45
  assert_equal 0, ie.end_of_image_padding
46
- assert_equal "IMAGE DESCRIPTION DATA \000P", ie.description
47
- assert_equal "E012\000\000\000\000x\340\264\020\000\000\000\000\005",
46
+ assert_equal "IMAGE DESCRIPTION DATA ", ie.description
47
+ assert_equal "E012",
48
48
  parsed.orientation.device #- this is where Flame writes the reel
49
49
 
50
50
  assert_equal 853, parsed.orientation.aspect_ratio[0]
@@ -129,6 +129,14 @@ class EditorTest < Test::Unit::TestCase
129
129
  assert_equal "E012", e.flame_reel
130
130
  end
131
131
 
132
+ def test_copy_from
133
+ e = Depix::Editor.new(SAMPLE_DPX)
134
+ assert_equal SAMPLE_DPX, e.path
135
+ another = Depix.from_file(File.dirname(__FILE__) + "/samples/northlight_tc_mode_mismatch.dpx")
136
+ e.copy_from(another)
137
+ assert_equal "Northlight", e.orientation.device
138
+ end
139
+
132
140
  def test_commit
133
141
  temp_path = SAMPLE_DPX + ".test"
134
142
  begin
data/test/test_dict.rb CHANGED
@@ -350,10 +350,10 @@ class TestCharField < Test::Unit::TestCase
350
350
  assert_equal String, f.rtype
351
351
  end
352
352
 
353
- def test_char_field_does_not_clean_inner_nulls
353
+ def test_char_field_cleans_inner_nulls
354
354
  f = CharField.new :name => :foo, :length => 15
355
- assert_equal "foo\0foo", f.clean("\0\0foo\0foo\0")
356
- assert_equal "swoop\377\0bla", f.clean("\0\0\0\377\377swoop\377\0bla\0\0\0\377\377\377\377\0\0\0")
355
+ assert_equal nil, f.clean("\0\0foo\0foo\0")
356
+ assert_equal nil, f.clean("\0\0\0\377\377swoop\377\0bla\0\0\0\377\377\377\377\0\0\0")
357
357
  end
358
358
 
359
359
  def test_char_field_clean_blank
@@ -361,7 +361,7 @@ class TestCharField < Test::Unit::TestCase
361
361
  assert_equal nil, f.clean("\0")
362
362
  assert_equal nil, f.clean("\0\0\0\0\0\0")
363
363
  assert_equal nil, f.clean("\0\0\0\377\377\0\0\0")
364
- assert_equal "foo\0foo", f.clean("\0\0foo\0foo\0")
364
+ assert_equal nil, f.clean("\0\0foo\0foo\0")
365
365
  end
366
366
 
367
367
  def test_char_field_validates_overflow
@@ -638,6 +638,8 @@ class TestDictConsume < Test::Unit::TestCase
638
638
 
639
639
  assert_equal "a", result.foo
640
640
  assert_equal "b", result.bar
641
+ assert_equal "a", result[:foo]
642
+ assert_equal "a", result["foo"]
641
643
  end
642
644
 
643
645
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: depix
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julik Tarkhanov
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-12-28 00:00:00 +01:00
12
+ date: 2010-02-10 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -21,6 +21,9 @@ dependencies:
21
21
  - - ">="
22
22
  - !ruby/object:Gem::Version
23
23
  version: "0"
24
+ - - "="
25
+ - !ruby/object:Gem::Version
26
+ version: 0.2.0
24
27
  version:
25
28
  - !ruby/object:Gem::Dependency
26
29
  name: hoe
@@ -45,7 +48,6 @@ extra_rdoc_files:
45
48
  - Manifest.txt
46
49
  - README.txt
47
50
  files:
48
- - .DS_Store
49
51
  - DPX_HEADER_STRUCTURE.txt
50
52
  - History.txt
51
53
  - Manifest.txt
@@ -61,13 +63,12 @@ files:
61
63
  - lib/depix/reader.rb
62
64
  - lib/depix/struct_explainer.rb
63
65
  - lib/depix/structs.rb
64
- - test/.DS_Store
65
- - test/samples/.DS_Store
66
66
  - test/samples/026_FROM_HERO_TAPE_5-3-1_MOV.0029.dpx
67
67
  - test/samples/E012_P001_L000002_lin.0001.dpx
68
68
  - test/samples/E012_P001_L000002_lin.0002.dpx
69
69
  - test/samples/E012_P001_L000002_log.0001.dpx
70
70
  - test/samples/E012_P001_L000002_log.0002.dpx
71
+ - test/samples/northlight_tc_mode_mismatch.dpx
71
72
  - test/test_depix.rb
72
73
  - test/test_dict.rb
73
74
  has_rdoc: true
data/.DS_Store DELETED
Binary file
data/test/.DS_Store DELETED
Binary file
Binary file