julik-depix 1.0.5 → 1.0.6

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.
@@ -18,7 +18,7 @@ DPX metadata gets returned as a Depix::DPX object with nested properties.
18
18
  * <tt>filename</tt> (String) Original filename
19
19
  * <tt>timestamp</tt> (String) Creation timestamp
20
20
  * <tt>creator</tt> (String) Creator application
21
- * <tt>roject</tt> (String) Project name
21
+ * <tt>project</tt> (String) Project name
22
22
  * <tt>copyright</tt> (String) Copyright
23
23
  * <tt>encrypt_key</tt> Encryption key
24
24
  * <tt>reserve</tt> (String)
@@ -1,3 +1,9 @@
1
+ === 1.0.7 / 2009-05-21
2
+
3
+ * Do not bail out on headers newer than V1.0
4
+ * Allow access to headers directly in Depix::Editor
5
+ * Fix project field name
6
+
1
7
  === 1.0.5 / 2009-01-18
2
8
 
3
9
  * Switch project to guerilla-di
data/README.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  = depix
2
2
 
3
- * http://wiretap.rubyforge.org/depix
3
+ * http://guerilla-di.rubyforge.org/depix
4
4
 
5
5
  == DESCRIPTION:
6
6
 
@@ -0,0 +1,40 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = %q{depix}
5
+ s.version = "1.0.6"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["Julik Tarkhanov"]
9
+ s.date = %q{2009-05-21}
10
+ s.default_executable = %q{depix-describe}
11
+ s.description = %q{Read and write DPX file metadata}
12
+ s.email = ["me@julik.nl"]
13
+ s.executables = ["depix-describe"]
14
+ s.extra_rdoc_files = ["DPX_HEADER_STRUCTURE.txt", "History.txt", "Manifest.txt", "README.txt"]
15
+ s.files = ["DPX_HEADER_STRUCTURE.txt", "History.txt", "Manifest.txt", "README.txt", "Rakefile", "bin/depix-describe", "depix.gemspec", "lib/depix.rb", "lib/depix/benchmark.rb", "lib/depix/compact_structs.rb", "lib/depix/dict.rb", "lib/depix/editor.rb", "lib/depix/enums.rb", "lib/depix/reader.rb", "lib/depix/struct_explainer.rb", "lib/depix/structs.rb", "test/samples/E012_P001_L000002_lin.0001.dpx", "test/samples/E012_P001_L000002_lin.0002.dpx", "test/samples/E012_P001_L000002_log.0001.dpx", "test/samples/E012_P001_L000002_log.0002.dpx", "test/test_depix.rb", "test/test_dict.rb"]
16
+ s.has_rdoc = true
17
+ s.homepage = %q{http://guerilla-di.rubyforge.org/depix}
18
+ s.rdoc_options = ["--main", "README.txt"]
19
+ s.require_paths = ["lib"]
20
+ s.rubyforge_project = %q{guerilla-di}
21
+ s.rubygems_version = %q{1.3.1}
22
+ s.summary = %q{Read and write DPX file metadata}
23
+ s.test_files = ["test/test_depix.rb", "test/test_dict.rb"]
24
+
25
+ if s.respond_to? :specification_version then
26
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
27
+ s.specification_version = 2
28
+
29
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
30
+ s.add_runtime_dependency(%q<timecode>, [">= 0"])
31
+ s.add_development_dependency(%q<hoe>, [">= 1.8.3"])
32
+ else
33
+ s.add_dependency(%q<timecode>, [">= 0"])
34
+ s.add_dependency(%q<hoe>, [">= 1.8.3"])
35
+ end
36
+ else
37
+ s.add_dependency(%q<timecode>, [">= 0"])
38
+ s.add_dependency(%q<hoe>, [">= 1.8.3"])
39
+ end
40
+ end
@@ -10,7 +10,7 @@ require File.dirname(__FILE__) + '/depix/editor'
10
10
 
11
11
 
12
12
  module Depix
13
- VERSION = '1.0.5'
13
+ VERSION = '1.0.7'
14
14
 
15
15
  class InvalidHeader < RuntimeError; end
16
16
 
@@ -1,32 +1,54 @@
1
+ require 'delegate'
2
+
1
3
  module Depix
2
4
  # Used to edit DPX headers. Create an Editor object and pass the path to the file to it. Change the headers variable to contain the edited
3
- # DPX headers and call commit!. Note that the DPX header will be overwritten in place - if you want to save another version you need to manage it yourself
4
- class Editor
5
+ # DPX headers and call commit!. Note that the DPX header will be overwritten in place - if you want to save another version you need to manage
6
+ # it yourself.
7
+ #
8
+ # dpx = Depix::Editor.new("/RAID/scans/1374470_adjusted.dpx")
9
+ # dpx.file.copyright = "Copyleft"
10
+ # dpx.file.reserve = "FileReserve"
11
+ # dpx.orientation.reserve = "OrientReserve"
12
+ # dpx.orientation.device = "Chainik"
13
+ # dpx.orientation.serial = "43"
14
+ # dpx.film.reserve = "FilmRezerve"
15
+ # dpx.file.project = "Mastermind"
16
+ #
17
+ # dpx.commit! # will write out the headers
18
+ class Editor < Delegator
5
19
 
6
20
  # Stores the path to file
7
21
  attr_reader :path
8
22
 
9
- # Stores the Depix::DPX object with headers
10
- attr_accessor :headers
11
-
12
23
  # Create a new editor for the file at path
13
24
  def initialize(file_path)
14
25
  @path = file_path
15
- @headers = Depix.from_file(@path)
26
+ @dpx = Depix.from_file(@path)
16
27
  end
17
28
 
18
29
  # Save the headers to file at path, overwriting the old ones
19
30
  def commit!
20
- raise "No headers" unless @headers
21
- raise "Cannot pack LE headers" if @headers.le?
22
- packed = @headers.class.pack(@headers)
31
+ raise "No headers" unless @dpx
32
+ raise "Cannot pack LE headers yet" if @dpx.le?
33
+ packed = @dpx.class.pack(@dpx)
23
34
 
24
35
  # Validate that we can unpack first - what if something went wrong?
25
36
  Depix::Reader.new.parse(packed, false)
26
37
 
38
+ # Use in-place writing into DPX file (this is what + does)
27
39
  File.open(@path, 'rb+') do | f |
28
40
  f.seek(0, IO::SEEK_SET); f.write(packed)
29
41
  end
30
42
  end
43
+
44
+ # DEPRECATED
45
+ def headers
46
+ STDERR.puts "Depix::Editor#headers is deprecated, use the Editor itself instead"
47
+ self
48
+ end
49
+
50
+ def __getobj__
51
+ @dpx # return object we are delegating to, required
52
+ end
31
53
  end
32
54
  end
@@ -26,14 +26,14 @@ module Depix
26
26
  # The hear of Depix
27
27
  def parse(data, compact)
28
28
  magic = data[0..3]
29
-
29
+
30
30
  raise InvalidHeader, "No magic bytes found at start" unless %w( SDPX XPDS).include?(magic)
31
-
31
+
32
32
  struct = compact ? CompactDPX : DPX
33
-
33
+
34
34
  is_be = (magic == "SDPX")
35
35
  version_check = FileInfo.only(:magic, :version)
36
-
36
+
37
37
  result = begin
38
38
  if is_be
39
39
  version_check.consume!(data.unpack(version_check.pattern))
@@ -43,8 +43,6 @@ module Depix
43
43
  rescue ArgumentError
44
44
  raise InvalidHeader
45
45
  end
46
-
47
- raise InvalidHeader, "Unknown version tag #{result.version}" unless result.version == "V1.0"
48
46
 
49
47
  template = is_be ? DPX.pattern : make_le(DPX.pattern)
50
48
  struct.consume!(data.unpack(struct.pattern))
@@ -17,7 +17,7 @@ module Depix
17
17
  char :filename, 100, :desc => 'Original filename'
18
18
  char :timestamp, 24, :desc => 'Creation timestamp'
19
19
  char :creator, 100, :desc => 'Creator application'
20
- char :roject, 200, :desc => 'Project name'
20
+ char :project, 200, :desc => 'Project name'
21
21
  char :copyright, 200, :desc => 'Copyright'
22
22
 
23
23
  u32 :encrypt_key, :desc => 'Encryption key'
@@ -119,7 +119,8 @@ class EditorTest < Test::Unit::TestCase
119
119
  e = Depix::Editor.new(SAMPLE_DPX)
120
120
  assert_not_nil e
121
121
  assert_equal SAMPLE_DPX, e.path
122
- assert_not_nil e.headers
122
+ assert_respond_to e, :flame_reel
123
+ assert_equal "E012", e.flame_reel
123
124
  end
124
125
 
125
126
  def test_commit
@@ -127,7 +128,7 @@ class EditorTest < Test::Unit::TestCase
127
128
  begin
128
129
  FileUtils.cp(SAMPLE_DPX, temp_path)
129
130
  e = Depix::Editor.new(temp_path)
130
- e.headers.flame_reel = "E013"
131
+ e.flame_reel = "E013"
131
132
 
132
133
  assert_nothing_raised { e.commit! }
133
134
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: julik-depix
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julik Tarkhanov
@@ -9,19 +9,30 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-12-26 00:00:00 -08:00
12
+ date: 2009-05-21 00:00:00 -07:00
13
13
  default_executable: depix-describe
14
14
  dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: timecode
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: "0"
24
+ version:
15
25
  - !ruby/object:Gem::Dependency
16
26
  name: hoe
27
+ type: :development
17
28
  version_requirement:
18
29
  version_requirements: !ruby/object:Gem::Requirement
19
30
  requirements:
20
31
  - - ">="
21
32
  - !ruby/object:Gem::Version
22
- version: 1.8.2
33
+ version: 1.8.3
23
34
  version:
24
- description: Read DPX file metadata
35
+ description: Read and write DPX file metadata
25
36
  email:
26
37
  - me@julik.nl
27
38
  executables:
@@ -29,32 +40,33 @@ executables:
29
40
  extensions: []
30
41
 
31
42
  extra_rdoc_files:
43
+ - DPX_HEADER_STRUCTURE.txt
32
44
  - History.txt
33
45
  - Manifest.txt
34
46
  - README.txt
35
- - DPX_HEADER_STRUCTURE.txt
36
47
  files:
48
+ - DPX_HEADER_STRUCTURE.txt
37
49
  - History.txt
38
50
  - Manifest.txt
39
51
  - README.txt
40
- - DPX_HEADER_STRUCTURE.txt
41
52
  - Rakefile
42
53
  - bin/depix-describe
54
+ - depix.gemspec
43
55
  - lib/depix.rb
44
- - lib/depix/struct_explainer.rb
45
- - lib/depix/structs.rb
46
56
  - lib/depix/benchmark.rb
47
57
  - lib/depix/compact_structs.rb
48
- - lib/depix/enums.rb
49
58
  - lib/depix/dict.rb
50
- - lib/depix/reader.rb
51
59
  - lib/depix/editor.rb
52
- - test/test_dict.rb
53
- - test/test_depix.rb
60
+ - lib/depix/enums.rb
61
+ - lib/depix/reader.rb
62
+ - lib/depix/struct_explainer.rb
63
+ - lib/depix/structs.rb
54
64
  - test/samples/E012_P001_L000002_lin.0001.dpx
55
65
  - test/samples/E012_P001_L000002_lin.0002.dpx
56
66
  - test/samples/E012_P001_L000002_log.0001.dpx
57
67
  - test/samples/E012_P001_L000002_log.0002.dpx
68
+ - test/test_depix.rb
69
+ - test/test_dict.rb
58
70
  has_rdoc: true
59
71
  homepage: http://guerilla-di.rubyforge.org/depix
60
72
  post_install_message:
@@ -81,7 +93,7 @@ rubyforge_project: guerilla-di
81
93
  rubygems_version: 1.2.0
82
94
  signing_key:
83
95
  specification_version: 2
84
- summary: Read DPX file metadata
96
+ summary: Read and write DPX file metadata
85
97
  test_files:
86
98
  - test/test_depix.rb
87
99
  - test/test_dict.rb