tracksperanto 3.4.1 → 3.5.0

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -15,20 +15,15 @@ gem "update_hints", "~> 1.0"
15
15
  group :development do
16
16
  gem "approximately"
17
17
 
18
- if RUBY_VERSION > "1.8" # Jeweler pulls Nokogiri which does not want to build on Travis in 1.8
19
- gem "jeweler", '~> 1.8.8'
20
- else
21
- gem "jeweler", '~> 1.8.4'
22
- end
23
-
24
18
  gem "rake"
25
19
  gem "linebyline"
26
20
 
27
- if RUBY_VERSION > "1.8"
28
- # Max. supported on 1.8
29
- gem "flexmock", "~> 1.3.2", :require => %w( flexmock flexmock/test_unit )
21
+ if RUBY_VERSION < "1.9"
22
+ gem "jeweler", '1.8.4' # Last one without the stupid nokogiri dependency
23
+ gem "flexmock", "~> 0.8", :require => %w( flexmock flexmock/test_unit ) # Max. supported on 1.8
30
24
  else
31
- gem "flexmock", "~> 0.8", :require => %w( flexmock flexmock/test_unit )
25
+ gem "jeweler", '~> 1.8'
26
+ gem "flexmock", "~> 1.3.2", :require => %w( flexmock flexmock/test_unit )
32
27
  end
33
28
 
34
29
  gem "cli_test", "~>1.0"
data/History.txt CHANGED
@@ -1,3 +1,7 @@
1
+ === 3.5.0
2
+
3
+ * Add early bailout if unsupported formats are fed in. Because some people just can't read.
4
+
1
5
  === 3.4.1
2
6
 
3
7
  * Fix parsing of curve expressions with modifiers in Nuke scripts
data/lib/pipeline/base.rb CHANGED
@@ -93,6 +93,9 @@ module Tracksperanto::Pipeline
93
93
  # Returns the number of trackers and the number of keyframes processed during the run
94
94
  def run(from_input_file_path, passed_options = {})
95
95
 
96
+ # Prevent formats that we do not support
97
+ Tracksperanto::Blacklist.raise_if_format_unsupported(from_input_file_path)
98
+
96
99
  # Check for empty files
97
100
  raise EmptySourceFileError if File.stat(from_input_file_path).size.zero?
98
101
 
data/lib/tracksperanto.rb CHANGED
@@ -5,13 +5,14 @@ require 'tempfile'
5
5
 
6
6
  module Tracksperanto
7
7
  PATH = File.expand_path(File.dirname(__FILE__))
8
- VERSION = '3.4.1'
8
+ VERSION = '3.5.0'
9
9
 
10
10
  module Import; end
11
11
  module Export; end
12
12
  module Tool; end
13
13
  module Pipeline; end
14
14
 
15
+ class UnsupportedFormatError < NameError; end
15
16
  class UnknownExporterError < NameError; end
16
17
  class UnknownImporterError < NameError; end
17
18
  class UnknownToolError < NameError; end
@@ -108,6 +109,7 @@ end
108
109
  parameters
109
110
  yield_non_empty
110
111
  pf_coords
112
+ blacklist
111
113
  ).each do | submodule |
112
114
  require File.join(Tracksperanto::PATH, "tracksperanto", submodule)
113
115
  end
@@ -0,0 +1,25 @@
1
+ # -*- encoding : utf-8 -*-
2
+ class Tracksperanto::Blacklist
3
+
4
+ # Prevent totally unsupported formats from being used
5
+ def self.raise_if_format_unsupported(judging_from_file_path)
6
+ extension = File.extname(judging_from_file_path).downcase
7
+ formats_and_extensions.each_pair do | matcher, message |
8
+ raise Tracksperanto::UnsupportedFormatError, message if matcher.is_a?(String) && extension == matcher
9
+ raise Tracksperanto::UnsupportedFormatError, message if matcher.is_a?(Regexp) && extension =~ matcher
10
+ end
11
+ end
12
+
13
+ def self.formats_and_extensions
14
+ {
15
+ '.ma' => 'We cannot import Maya ASCII files directly. For processing Maya Live tracks export them from Maya.',
16
+ '.mb' => 'We cannot import Maya ASCII files directly. For processing Maya Live tracks export them from Maya.',
17
+ /\.(mov|avi|xvid|mp4)$/ => 'Tracksperanto is not a tracking application, it converts tracks. We do not support movie file formats.',
18
+ /\.(r3d)$/ => 'Tracksperanto is not a tracking application, it converts tracks. We do not support RAW file formats.',
19
+ /\.(dpx|tif(f?)|jp(e?)g|png|gif|tga)$/ => 'Tracksperanto is not a tracking application, it converts tracks. We do not support image file formats.',
20
+ '.sni' => 'We cannot read binary SynthEyes scene files. Export your tracks as one of the supported formats.',
21
+ '.pfb' => 'We cannot directly open PFTrack projects, export .2dt files instead',
22
+ '.mmf' => 'We cannot directly open MatchMover projects, please export your tracks as .rz2 instead',
23
+ }
24
+ end
25
+ end
@@ -0,0 +1,36 @@
1
+ # -*- encoding : utf-8 -*-
2
+ require File.expand_path(File.dirname(__FILE__)) + '/helper'
3
+
4
+ class TestBlacklist < Test::Unit::TestCase
5
+
6
+ def test_non_blacklisted_formats
7
+ %( file.txt file.2dt file.stabilizer ).each do | filename |
8
+ Tracksperanto::Blacklist.raise_if_format_unsupported(filename)
9
+ end
10
+ assert true, 'No exceptions should have been raised'
11
+ end
12
+
13
+ def test_blacklisted_formats
14
+ %w(
15
+ file.jpg
16
+ file.tif
17
+ file.tiff
18
+ file.mov
19
+ file.r3d
20
+ file.dpx
21
+ file.jpg
22
+ file.gif
23
+ file.PNG
24
+ file.sni
25
+ file.ma
26
+ file.mb
27
+ file.pfb
28
+ file.mmf
29
+ ).each do | filename |
30
+ error = assert_raise(Tracksperanto::UnsupportedFormatError, "Should fail for #{filename.inspect}") do
31
+ Tracksperanto::Blacklist.raise_if_format_unsupported(filename)
32
+ end
33
+ assert_operator error.message.length, :>, 5, 'Should contain a descriptive error message'
34
+ end
35
+ end
36
+ end
@@ -45,6 +45,15 @@ class TestPipeline < Test::Unit::TestCase
45
45
  end
46
46
  end
47
47
 
48
+ def test_run_for_unsupported_format_raises_exception
49
+ pipeline = Tracksperanto::Pipeline::Base.new
50
+ %w( file.MOV file.mb vfx/shots/file.SNI ).each do | path |
51
+ assert_raise(Tracksperanto::UnsupportedFormatError) do
52
+ pipeline.run(path)
53
+ end
54
+ end
55
+ end
56
+
48
57
  def test_run_with_autodetected_importer_and_size_with_progress_block
49
58
  in_temp_dir do
50
59
  create_stabilizer_file
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{tracksperanto}
8
- s.version = "3.4.1"
8
+ s.version = "3.5.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Julik Tarkhanov"]
12
- s.date = %q{2014-03-05}
12
+ s.date = %q{2014-06-26}
13
13
  s.default_executable = %q{tracksperanto}
14
14
  s.description = %q{Converts 2D track exports between different apps like Flame, MatchMover, PFTrack...}
15
15
  s.email = %q{me@julik.nl}
@@ -83,6 +83,7 @@ Gem::Specification.new do |s|
83
83
  "lib/tools/slipper.rb",
84
84
  "lib/tools/start_trim.rb",
85
85
  "lib/tracksperanto.rb",
86
+ "lib/tracksperanto/blacklist.rb",
86
87
  "lib/tracksperanto/block_init.rb",
87
88
  "lib/tracksperanto/buffer_io.rb",
88
89
  "lib/tracksperanto/casts.rb",
@@ -172,6 +173,7 @@ Gem::Specification.new do |s|
172
173
  "test/subpixel/subpixel_grid.sni",
173
174
  "test/subpixel/subpixel_grid.tif",
174
175
  "test/subpixel/sy_subpix_2dpaths.txt",
176
+ "test/test_blacklist.rb",
175
177
  "test/test_block_init.rb",
176
178
  "test/test_buffer_io.rb",
177
179
  "test/test_casts.rb",
@@ -226,10 +228,10 @@ Gem::Specification.new do |s|
226
228
  s.add_runtime_dependency(%q<progressbar>, ["= 0.10.0"])
227
229
  s.add_runtime_dependency(%q<update_hints>, ["~> 1.0"])
228
230
  s.add_development_dependency(%q<approximately>, [">= 0"])
229
- s.add_development_dependency(%q<jeweler>, ["~> 1.8.8"])
230
231
  s.add_development_dependency(%q<rake>, [">= 0"])
231
232
  s.add_development_dependency(%q<linebyline>, [">= 0"])
232
- s.add_development_dependency(%q<flexmock>, ["~> 1.3.2"])
233
+ s.add_development_dependency(%q<jeweler>, ["= 1.8.4"])
234
+ s.add_development_dependency(%q<flexmock>, ["~> 0.8"])
233
235
  s.add_development_dependency(%q<cli_test>, ["~> 1.0"])
234
236
  s.add_development_dependency(%q<rake-hooks>, ["~> 1.2.3"])
235
237
  else
@@ -242,10 +244,10 @@ Gem::Specification.new do |s|
242
244
  s.add_dependency(%q<progressbar>, ["= 0.10.0"])
243
245
  s.add_dependency(%q<update_hints>, ["~> 1.0"])
244
246
  s.add_dependency(%q<approximately>, [">= 0"])
245
- s.add_dependency(%q<jeweler>, ["~> 1.8.8"])
246
247
  s.add_dependency(%q<rake>, [">= 0"])
247
248
  s.add_dependency(%q<linebyline>, [">= 0"])
248
- s.add_dependency(%q<flexmock>, ["~> 1.3.2"])
249
+ s.add_dependency(%q<jeweler>, ["= 1.8.4"])
250
+ s.add_dependency(%q<flexmock>, ["~> 0.8"])
249
251
  s.add_dependency(%q<cli_test>, ["~> 1.0"])
250
252
  s.add_dependency(%q<rake-hooks>, ["~> 1.2.3"])
251
253
  end
@@ -259,10 +261,10 @@ Gem::Specification.new do |s|
259
261
  s.add_dependency(%q<progressbar>, ["= 0.10.0"])
260
262
  s.add_dependency(%q<update_hints>, ["~> 1.0"])
261
263
  s.add_dependency(%q<approximately>, [">= 0"])
262
- s.add_dependency(%q<jeweler>, ["~> 1.8.8"])
263
264
  s.add_dependency(%q<rake>, [">= 0"])
264
265
  s.add_dependency(%q<linebyline>, [">= 0"])
265
- s.add_dependency(%q<flexmock>, ["~> 1.3.2"])
266
+ s.add_dependency(%q<jeweler>, ["= 1.8.4"])
267
+ s.add_dependency(%q<flexmock>, ["~> 0.8"])
266
268
  s.add_dependency(%q<cli_test>, ["~> 1.0"])
267
269
  s.add_dependency(%q<rake-hooks>, ["~> 1.2.3"])
268
270
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tracksperanto
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 19
5
5
  prerelease:
6
6
  segments:
7
7
  - 3
8
- - 4
9
- - 1
10
- version: 3.4.1
8
+ - 5
9
+ - 0
10
+ version: 3.5.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Julik Tarkhanov
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2014-03-05 00:00:00 +01:00
18
+ date: 2014-06-26 00:00:00 +02:00
19
19
  default_executable: tracksperanto
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -156,16 +156,14 @@ dependencies:
156
156
  requirement: &id010 !ruby/object:Gem::Requirement
157
157
  none: false
158
158
  requirements:
159
- - - ~>
159
+ - - ">="
160
160
  - !ruby/object:Gem::Version
161
- hash: 39
161
+ hash: 3
162
162
  segments:
163
- - 1
164
- - 8
165
- - 8
166
- version: 1.8.8
163
+ - 0
164
+ version: "0"
167
165
  type: :development
168
- name: jeweler
166
+ name: rake
169
167
  version_requirements: *id010
170
168
  prerelease: false
171
169
  - !ruby/object:Gem::Dependency
@@ -179,21 +177,23 @@ dependencies:
179
177
  - 0
180
178
  version: "0"
181
179
  type: :development
182
- name: rake
180
+ name: linebyline
183
181
  version_requirements: *id011
184
182
  prerelease: false
185
183
  - !ruby/object:Gem::Dependency
186
184
  requirement: &id012 !ruby/object:Gem::Requirement
187
185
  none: false
188
186
  requirements:
189
- - - ">="
187
+ - - "="
190
188
  - !ruby/object:Gem::Version
191
- hash: 3
189
+ hash: 63
192
190
  segments:
193
- - 0
194
- version: "0"
191
+ - 1
192
+ - 8
193
+ - 4
194
+ version: 1.8.4
195
195
  type: :development
196
- name: linebyline
196
+ name: jeweler
197
197
  version_requirements: *id012
198
198
  prerelease: false
199
199
  - !ruby/object:Gem::Dependency
@@ -202,12 +202,11 @@ dependencies:
202
202
  requirements:
203
203
  - - ~>
204
204
  - !ruby/object:Gem::Version
205
- hash: 31
205
+ hash: 27
206
206
  segments:
207
- - 1
208
- - 3
209
- - 2
210
- version: 1.3.2
207
+ - 0
208
+ - 8
209
+ version: "0.8"
211
210
  type: :development
212
211
  name: flexmock
213
212
  version_requirements: *id013
@@ -317,6 +316,7 @@ files:
317
316
  - lib/tools/slipper.rb
318
317
  - lib/tools/start_trim.rb
319
318
  - lib/tracksperanto.rb
319
+ - lib/tracksperanto/blacklist.rb
320
320
  - lib/tracksperanto/block_init.rb
321
321
  - lib/tracksperanto/buffer_io.rb
322
322
  - lib/tracksperanto/casts.rb
@@ -406,6 +406,7 @@ files:
406
406
  - test/subpixel/subpixel_grid.sni
407
407
  - test/subpixel/subpixel_grid.tif
408
408
  - test/subpixel/sy_subpix_2dpaths.txt
409
+ - test/test_blacklist.rb
409
410
  - test/test_block_init.rb
410
411
  - test/test_buffer_io.rb
411
412
  - test/test_casts.rb