libis-format 0.9.22 → 0.9.23
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/libis/format/converter/base.rb +6 -3
- data/lib/libis/format/converter/image_converter.rb +4 -10
- data/lib/libis/format/converter/jp2_converter.rb +7 -5
- data/lib/libis/format/converter/office_converter.rb +3 -2
- data/lib/libis/format/converter/pdf_converter.rb +3 -2
- data/lib/libis/format/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6da0d346cc0447e615991fd72637a58dad86c4fa
|
4
|
+
data.tar.gz: dc22da7ae4018757274d2b0531af680438c26498
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2006e623d07fca05eccb2eed9e2223c4c44bd202053231227f26b5564f308c41ff0810796556eeb32e9f3804e5798be93bb123b7f67db02837bf1f2ded468ff9
|
7
|
+
data.tar.gz: 29d8ab43eb47664695ab6c705768529ba53eff4df1a06bf86a695f7aabe58c691f3724dd679203aabdf340c3bf576749d45f9d9663e98269acdc4e153a24a2a1
|
@@ -30,16 +30,19 @@ module Libis
|
|
30
30
|
@flags.merge!(opts[:flags]) if opts[:flags]
|
31
31
|
end
|
32
32
|
|
33
|
-
def self.input_types
|
33
|
+
def self.input_types
|
34
34
|
raise RuntimeError, 'Method #input_types needs to be overridden in converter'
|
35
35
|
end
|
36
36
|
|
37
|
-
def self.output_types(
|
37
|
+
def self.output_types(_format = nil)
|
38
38
|
raise RuntimeError, 'Method #output_types needs to be overridden in converter'
|
39
39
|
end
|
40
40
|
|
41
|
+
def using_temp(target, &block)
|
42
|
+
self.class.using_temp(target, &block)
|
43
|
+
end
|
41
44
|
|
42
|
-
def using_temp(target)
|
45
|
+
def Base.using_temp(target)
|
43
46
|
tempfile = File.join(Dir.tmpdir, Dir::Tmpname.make_tmpname(['convert', File.extname(target)], File.basename(target, '.*').gsub(/\s/, '_')))
|
44
47
|
result = yield tempfile
|
45
48
|
return nil unless result
|
@@ -14,19 +14,13 @@ module Libis
|
|
14
14
|
|
15
15
|
class ImageConverter < Libis::Format::Converter::Base
|
16
16
|
|
17
|
-
def self.input_types
|
17
|
+
def self.input_types
|
18
18
|
[:TIFF, :JPG, :PNG, :BMP, :GIF, :JP2, :PDF]
|
19
19
|
end
|
20
20
|
|
21
|
-
def self.output_types(
|
22
|
-
|
23
|
-
|
24
|
-
[:JP2]
|
25
|
-
when *(input_types - [:JP2])
|
26
|
-
input_types - [:JP2]
|
27
|
-
else
|
28
|
-
[]
|
29
|
-
end
|
21
|
+
def self.output_types(format = nil)
|
22
|
+
return [] unless input_types.include?(format)
|
23
|
+
[:TIFF, :JPG, :PNG, :BMP, :GIF, :JP2, :PDF]
|
30
24
|
end
|
31
25
|
|
32
26
|
def initialize
|
@@ -10,11 +10,12 @@ module Libis
|
|
10
10
|
|
11
11
|
class Jp2Converter < Libis::Format::Converter::Base
|
12
12
|
|
13
|
-
def self.input_types
|
13
|
+
def self.input_types
|
14
14
|
[:TIFF, :JPG, :PNG, :BMP, :GIF, :PDF]
|
15
15
|
end
|
16
16
|
|
17
|
-
def self.output_types(
|
17
|
+
def self.output_types(format = nil)
|
18
|
+
return [] unless input_types.include?(format)
|
18
19
|
[:JP2]
|
19
20
|
end
|
20
21
|
|
@@ -68,7 +69,7 @@ module Libis
|
|
68
69
|
@options.each do |key, value|
|
69
70
|
case key
|
70
71
|
when :color_xform
|
71
|
-
options << '--set-output-j2k-color-xform' << value ? 'YES' : 'NO'
|
72
|
+
options << '--set-output-j2k-color-xform' << (value ? 'YES' : 'NO')
|
72
73
|
when :error_resilience
|
73
74
|
options << '--set-output-j2k-error-resilience' << value.to_s
|
74
75
|
when :lossless
|
@@ -92,9 +93,10 @@ module Libis
|
|
92
93
|
Libis::Tools::Command.run(
|
93
94
|
Libis::Format::Config[:j2kdriver],
|
94
95
|
'--input-file-name', source,
|
95
|
-
'--output-file-name', target,
|
96
96
|
'--set-output-type', 'JP2',
|
97
|
-
*options
|
97
|
+
*options,
|
98
|
+
'--output-file-name', target,
|
99
|
+
|
98
100
|
)
|
99
101
|
|
100
102
|
target
|
@@ -11,7 +11,7 @@ module Libis
|
|
11
11
|
|
12
12
|
class OfficeConverter < Libis::Format::Converter::Base
|
13
13
|
|
14
|
-
def self.input_types
|
14
|
+
def self.input_types
|
15
15
|
[
|
16
16
|
:TXT,
|
17
17
|
:RTF,
|
@@ -26,7 +26,8 @@ module Libis
|
|
26
26
|
]
|
27
27
|
end
|
28
28
|
|
29
|
-
def self.output_types(
|
29
|
+
def self.output_types(format = nil)
|
30
|
+
return [] unless input_types.include?(format)
|
30
31
|
[:PDF]
|
31
32
|
end
|
32
33
|
|
@@ -13,11 +13,12 @@ module Libis
|
|
13
13
|
|
14
14
|
class PdfConverter < Libis::Format::Converter::Base
|
15
15
|
|
16
|
-
def self.input_types
|
16
|
+
def self.input_types
|
17
17
|
[:PDF]
|
18
18
|
end
|
19
19
|
|
20
|
-
def self.output_types(
|
20
|
+
def self.output_types(format = nil)
|
21
|
+
return [] unless input_types.include?(format)
|
21
22
|
[:PDF, :PDFA]
|
22
23
|
end
|
23
24
|
|
data/lib/libis/format/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: libis-format
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.23
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kris Dekeyser
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-05-
|
11
|
+
date: 2016-05-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|