libis-format 1.0.5 → 2.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +5 -1
  3. data/.travis.yml +32 -24
  4. data/README.md +2 -2
  5. data/base/Dockerfile +24 -2
  6. data/base/Dockerfile.alpine +20 -0
  7. data/base/Dockerfile.rvm +56 -0
  8. data/base/rework_path +20 -0
  9. data/docker_cfg.yml +1 -0
  10. data/lib/libis/format.rb +12 -3
  11. data/lib/libis/format/cli/convert.rb +4 -4
  12. data/lib/libis/format/config.rb +16 -12
  13. data/lib/libis/format/converter/audio_converter.rb +2 -36
  14. data/lib/libis/format/converter/base.rb +22 -8
  15. data/lib/libis/format/converter/chain.rb +3 -3
  16. data/lib/libis/format/converter/image_assembler.rb +82 -0
  17. data/lib/libis/format/converter/image_converter.rb +20 -138
  18. data/lib/libis/format/converter/image_splitter.rb +84 -0
  19. data/lib/libis/format/converter/image_watermarker.rb +261 -0
  20. data/lib/libis/format/converter/jp2_converter.rb +1 -1
  21. data/lib/libis/format/converter/office_converter.rb +2 -2
  22. data/lib/libis/format/converter/pdf_assembler.rb +66 -0
  23. data/lib/libis/format/converter/pdf_converter.rb +6 -132
  24. data/lib/libis/format/converter/pdf_metadata.rb +82 -0
  25. data/lib/libis/format/converter/pdf_optimizer.rb +67 -0
  26. data/lib/libis/format/converter/pdf_protecter.rb +147 -0
  27. data/lib/libis/format/converter/pdf_selecter.rb +83 -0
  28. data/lib/libis/format/converter/pdf_splitter.rb +70 -0
  29. data/lib/libis/format/converter/pdf_watermarker_header.rb +71 -0
  30. data/lib/libis/format/converter/pdf_watermarker_image.rb +76 -0
  31. data/lib/libis/format/converter/pdf_watermarker_text.rb +93 -0
  32. data/lib/libis/format/converter/spreadsheet_converter.rb +2 -2
  33. data/lib/libis/format/converter/video_converter.rb +1 -1
  34. data/lib/libis/format/identifier.rb +3 -3
  35. data/lib/libis/format/info.rb +27 -0
  36. data/lib/libis/format/library.rb +147 -0
  37. data/lib/libis/format/tool.rb +4 -1
  38. data/lib/libis/format/tool/extension_identification.rb +4 -4
  39. data/lib/libis/format/tool/identification_tool.rb +6 -6
  40. data/lib/libis/format/tool/pdf_merge.rb +3 -3
  41. data/lib/libis/format/tool/{pdf_copy.rb → pdf_metadata.rb} +5 -5
  42. data/lib/libis/format/tool/pdf_protect.rb +47 -0
  43. data/lib/libis/format/tool/pdf_select.rb +47 -0
  44. data/lib/libis/format/tool/pdf_split.rb +4 -4
  45. data/lib/libis/format/tool/pdf_watermark.rb +47 -0
  46. data/lib/libis/format/tool/spreadsheet_to_ods.rb +1 -0
  47. data/lib/libis/format/version.rb +1 -1
  48. data/lib/libis/format/yaml_loader.rb +71 -0
  49. data/libis-format.gemspec +3 -2
  50. data/tools/PdfTool.jar +0 -0
  51. data/tools/bcpkix-jdk15on-167.jar +0 -0
  52. data/tools/bcprov-jdk15on-167.jar +0 -0
  53. metadata +32 -13
  54. data/lib/libis/format/type_database.rb +0 -134
  55. data/lib/libis/format/type_database_impl.rb +0 -120
  56. data/tools/bcpkix-jdk15on-1.49.jar +0 -0
  57. data/tools/bcprov-jdk15on-1.49.jar +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c9fd6394c2eb7964f14d60e8c0ae9b116b8b4e6c12e0a8ee8cffc6b1f94063d1
4
- data.tar.gz: 60ef07f34501ce38ab9a3551009aeab0548cee6dbd02612ca2c6ec2da884d288
3
+ metadata.gz: 4b7038f7206f0eeef883d0571657efca3999970d64abb78c2507bdc3a92a0c95
4
+ data.tar.gz: 6225fc365aba08fb6307997ce0b2615c4ea1f4c20ae9cb3765ebecc8e7ea5211
5
5
  SHA512:
6
- metadata.gz: 4d72580ea2c577507190fa7c8f05dc29edb01e76ff16a8f55669575ca52006eafd26ca9d184628ea9b69d292a9b15b98289722cb25e17ec5d71df496114b1116
7
- data.tar.gz: 72ef4b7c04340d86f61fb4211cc4532147c3933a16fefabadce7eacd524981b012ba1dfcdf1e52a29f7ff287488b1bc73ff846de9d04eb3afaea243e91a5a104
6
+ metadata.gz: dcce329e2ad5a6e3991e3d7eca4a35d6dc19b96d9cd83ff109bb744d7c51238ed66a9484000b260b007778df42a00ff1fc4077d387752d72fec25bebe221ed31
7
+ data.tar.gz: 77328b76c2703a8611638bbfbf0b9bf19996f694a04389191254c896471481ffb4ed87e57de7a000dfc67d106a281277e3226f85cb93ee08d44df4b7c526f383
data/.gitignore CHANGED
@@ -7,6 +7,7 @@
7
7
  /pkg/
8
8
  /spec/reports/
9
9
  /spec/work/
10
+ /spec/tmp/
10
11
  /tmp/
11
12
  *.bundle
12
13
  *.so
@@ -15,4 +16,7 @@
15
16
  mkmf.log
16
17
  /.idea/
17
18
  *.pyc
18
- tools/pdf/
19
+ tools/pdf/
20
+ /test*
21
+ /*~
22
+ /*.pdf
data/.travis.yml CHANGED
@@ -1,41 +1,45 @@
1
+ dist: bionic
1
2
  language: ruby
2
- sudo: false
3
- dist: trusty
4
3
  cache: bundler
4
+ sudo: false
5
5
  rvm:
6
- - 2.1.10
7
- - 2.2.8
8
- - 2.3.5
9
- - 2.4.2
6
+ - 2.3
7
+ - 2.4
8
+ - 2.5
9
+ - 2.6
10
10
  - ruby-head
11
- - jruby-9.0.5.0
12
- - jruby-9.1.9.0
11
+ - jruby-9.1
12
+ - jruby-9.2
13
13
  - jruby-head
14
14
  jdk:
15
- - openjdk8
16
- - oraclejdk8
15
+ - openjdk10
16
+ - openjdk11
17
17
  matrix:
18
18
  exclude:
19
- - rvm: 2.1.10
20
- jdk: oraclejdk8
21
- - rvm: 2.2.8
22
- jdk: oraclejdk8
23
- - rvm: 2.3.5
24
- jdk: oraclejdk8
25
- - rvm: 2.4.2
26
- jdk: oraclejdk8
19
+ - rvm: 2.3
20
+ jdk: openjdk10
21
+ - rvm: 2.4
22
+ jdk: openjdk10
23
+ - rvm: 2.5
24
+ jdk: openjdk10
25
+ - rvm: 2.6
26
+ jdk: openjdk10
27
27
  - rvm: ruby-head
28
- jdk: oraclejdk8
28
+ jdk: openjdk10
29
29
  allow_failures:
30
30
  - rvm: ruby-head
31
31
  - rvm: jruby-head
32
32
  branches:
33
33
  only:
34
- - master
34
+ - master
35
+ - v2
35
36
  before_install:
36
- - sudo add-apt-repository ppa:mc3man/trusty-media -y
37
+ - gem update --system
38
+ - gem --version
39
+ - sudo add-apt-repository ppa:mc3man/bionic-media -y
37
40
  - sudo apt-get update -y -q
38
- - sudo apt-get install -y -q ffmpeg gstreamer0.10-ffmpeg
41
+ - sudo apt-get install
42
+ - sudo apt-get install -y -q ffmpeg ubuntu-restricted-extras
39
43
  - sudo pip install --upgrade pip
40
44
  - sudo pip install --upgrade --ignore-installed opf-fido six
41
45
  - sudo wget -O droid.zip -q http://www.nationalarchives.gov.uk/documents/information-management/droid-binary-6.4-bin.zip
@@ -43,8 +47,12 @@ before_install:
43
47
  - sudo unzip droid.zip -d /opt/droid
44
48
  - sudo chmod 755 /opt/droid/droid.sh
45
49
  - sudo locale-gen "en_US.UTF-8"
46
- - sudo dpkg-reconfigure locales
47
- - echo "8\n9\n" | sudo apt-get install tzdata
50
+ - echo 'Europe/Brussels' | sudo tee /etc/timezone
51
+ - export TZ=Europe/Brussels
52
+ - sudo dpkg-reconfigure --frontend noninteractive tzdata
53
+ - date
54
+ before_script:
55
+ - export TZ=Europe/Brussels
48
56
  env:
49
57
  - LC_ALL=en_US.UTF-8
50
58
  - LANG=en_US.UTF-8
data/README.md CHANGED
@@ -26,9 +26,9 @@ Or install it yourself as:
26
26
 
27
27
  ## Usage
28
28
 
29
- ### ::Libis::Format::TypeDatabase
29
+ ### ::Libis::Format::Library
30
30
 
31
- The type database is the core of the format services. It stores information about all the known formats.
31
+ The format database is the core of the format services. It stores information about all the known formats.
32
32
 
33
33
  ### ::Libis::Format::Identifier
34
34
 
data/base/Dockerfile CHANGED
@@ -1,13 +1,35 @@
1
1
  FROM ubuntu:18.04
2
- RUN apt-get -q update
3
- RUN apt-get -q -y install wget unzip imagemagick python2.7 python-pip openjdk-8-jre-headless libreoffice --no-install-recommends
2
+ RUN apt-get -q update \
3
+ && apt-get install -q -y --no-install-recommends \
4
+ wget \
5
+ unzip \
6
+ imagemagick \
7
+ python2.7 \
8
+ python-pip \
9
+ openjdk-8-jre-headless \
10
+ libreoffice \
11
+ ghostscript
12
+
13
+ RUN apt-get clean \
14
+ && rm -rf /var/lib/apt/lists/*
15
+
4
16
  RUN pip install --upgrade pip && pip install opf-fido
17
+
5
18
  RUN wget -q -O droid.zip "http://www.nationalarchives.gov.uk/documents/information-management/droid-binary-6.4-bin.zip" \
6
19
  && mkdir -p /opt/droid \
7
20
  && unzip -d /opt/droid droid.zip \
8
21
  && chmod 755 /opt/droid/droid.sh \
9
22
  && rm droid.zip
23
+
10
24
  RUN wget -q -O fop.tar.gz "http://www.apache.org/dyn/closer.cgi?filename=/xmlgraphics/fop/binaries/fop-2.3-bin.tar.gz&action=download" \
11
25
  && mkdir -p /opt/fop \
12
26
  && tar xzf fop.tar.gz -C /opt/fop --strip-components=2 \
13
27
  && rm fop.tar.gz
28
+
29
+ RUN echo "8\n9\n" | apt-get install tzdata
30
+ RUN mkdir -p /teneo/format/spec
31
+ ADD ./tools /teneo/format/tools
32
+ ADD ./data /teneo/format/data
33
+ ADD ./spec/data /teneo/format/spec/data
34
+ ADD ./base/rework_path /teneo/format/rework_path
35
+ CMD /bin/bash
@@ -0,0 +1,20 @@
1
+ FROM alpine:3.8
2
+ LABEL maintainer="kris.dekeyser@libis.be"
3
+ RUN apk update -q && apk upgrade -q
4
+ RUN apk add -q python2 py-pip openjdk8-jre ffmpeg libreoffice ttf-liberation ttf-freefont ttf-opensans sox git wget unzip sudo bash curl tar imagemagick
5
+ # install fido
6
+ RUN pip install -q --upgrade pip && pip install -q opf-fido
7
+ # install droid
8
+ RUN wget -q -O droid.zip http://www.nationalarchives.gov.uk/documents/information-management/droid-binary-6.4-bin.zip \
9
+ && mkdir -p /opt/droid \
10
+ && unzip -q -d /opt/droid droid.zip \
11
+ && chmod 755 /opt/droid/droid.sh \
12
+ && rm droid.zip
13
+ # install ImageMagick
14
+ RUN apk add -q imagemagick
15
+ ADD ../tools /tools
16
+ ADD ../data /cfg
17
+ VOLUME /data
18
+ WORKDIR /data
19
+
20
+ CMD ["/bin/bash", "-l"]
@@ -0,0 +1,56 @@
1
+ ARG ubuntu_ver=latest
2
+ ARG ruby_ver=2.5.3
3
+ ARG node_ver=10.15.0
4
+
5
+ FROM ubuntu:${ubuntu_ver}
6
+ LABEL maintainer="kris.dekeyser@libis.be"
7
+
8
+ ENV RUBY_ENV=${ruby_ver}
9
+ ENV NVM_DIR=/usr/local/nvm
10
+ ENV NODE_VER=${node_ver}
11
+ ENV NODE_PATH=$NVM_DIR/v$NODE_VER/lib/node_modules
12
+ ENV NODE_PATH=$NVM_DIR/versions/node/v$NODE_VER/bin
13
+ ENV PATH "${PATH}:${NODE_PATH}:${NODE_PATH}/npm"
14
+
15
+ RUN echo $RUBY_ENV
16
+
17
+ ENV DEBIAN_FRONTEND=noninteractive
18
+ RUN apt-get update -q \
19
+ && apt-get install -y -q --no-install-recommends software-properties-common apt-utils
20
+ RUN apt-add-repository -y ppa:rael-gc/rvm \
21
+ && apt-get update -q
22
+ RUN apt-get install -y -q --no-install-recommends \
23
+ build-essential \
24
+ gnupg2 \
25
+ git \
26
+ wget \
27
+ curl \
28
+ sudo \
29
+ unzip \
30
+ openjdk-8-jre-headless
31
+
32
+ ENV BASH_ENV='/etc/profile exec bash'
33
+ SHELL ["/bin/bash", "-l", "-c"]
34
+
35
+ RUN addgroup --gid 2000 teneo \
36
+ && adduser --uid 2000 --gid 2000 --disabled-password --gecos "Teneo user" teneo \
37
+ && usermod -L -s /bin/bash teneo
38
+ RUN echo 'teneo ALL = (ALL) NOPASSWD: ALL' >> /etc/sudoers
39
+
40
+ USER teneo
41
+
42
+ RUN gpg2 --keyserver hkp://pool.sks-keyservers.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
43
+
44
+ RUN curl -sSL https://get.rvm.io | bash -s stable
45
+
46
+ RUN echo 'gem: --no-document' > ${HOME}/.gemrc
47
+ RUN echo rvm install ${ruby_ver}
48
+ RUN echo rvm use ${RUBY_ENV}@teneo --create --ruby-version --ruby-gems
49
+
50
+ # required due to bug in rubygems (https://github.com/rubygems/rubygems/issues/2483)
51
+ RUN gem install rdoc bundler
52
+ RUN gem update --no-document --system
53
+ RUN rvm info
54
+ #ADD . /home/libis/libis_format
55
+ #WORKDIR /home/libis/libis_format
56
+ #RUN bundle install && bundle exec rake spec
data/base/rework_path ADDED
@@ -0,0 +1,20 @@
1
+ #!/bin/bash
2
+
3
+ CMD=$1
4
+ shift
5
+
6
+ readarray -d ',' -t mapping <<< "$VOLUME_MAPPING"
7
+
8
+ args=("$@")
9
+ #echo "args: ${args[@]}"
10
+ for map in "${mapping[@]}"
11
+ do
12
+ map="${map//[$'\t\r\n ']}"
13
+ readarray -d '=' -t m <<< "$map"
14
+ src="${m[0]//[$'\t\r\n ']}"
15
+ tgt="${m[1]//[$'\t\r\n ']}"
16
+ # echo "$src -> $tgt"
17
+ args=("${args[@]/$src/$tgt}")
18
+ # echo "args: ${args[@]}"
19
+ done
20
+ ${CMD} "${args[@]}"
data/docker_cfg.yml ADDED
@@ -0,0 +1 @@
1
+ :fop_jar: '/tools/fop.jar'
data/lib/libis/format.rb CHANGED
@@ -3,8 +3,11 @@ require 'libis/format/version'
3
3
  module Libis
4
4
  module Format
5
5
  autoload :Config, 'libis/format/config'
6
- autoload :TypeDatabase, 'libis/format/type_database'
7
- autoload :TypeDatabaseImpl, 'libis/format/type_database_impl'
6
+
7
+ autoload :Info, 'libis/format/info'
8
+ autoload :Library, 'libis/format/library'
9
+ autoload :YamlLoader, 'libis/format/yaml_loader'
10
+
8
11
  autoload :Identifier, 'libis/format/identifier'
9
12
 
10
13
  autoload :Tool, 'libis/format/tool'
@@ -15,4 +18,10 @@ module Libis
15
18
  TOOL_DIR = File.join(ROOT_DIR, 'tools')
16
19
 
17
20
  end
18
- end
21
+ end
22
+
23
+ class Object
24
+ def blank?
25
+ respond_to?(:empty?) ? !!empty? : !self
26
+ end unless defined? :blank?
27
+ end
@@ -67,7 +67,7 @@ module Libis
67
67
  arguments that any of the targetted converters support.
68
68
 
69
69
  The source file's format will be identified by the Libis::Format::Identifier and the target file's format
70
- will be derived from the file's extension. The Libis::Format::TypeDatabase is used to relate extensions
70
+ will be derived from the file's extension. The Libis::Format::Library is used to relate extensions
71
71
  with formats.
72
72
 
73
73
  DESC
@@ -89,7 +89,7 @@ module Libis
89
89
  A source file name and target file name should be supplied. The source file should exist and be readable.
90
90
  The target file should be writable, but should not exist.
91
91
 
92
- The target file's format will be derived from the file's extension. The Libis::Format::TypeDatabase is used
92
+ The target file's format will be derived from the file's extension. The Libis::Format::Library is used
93
93
  to relate extensions with formats.
94
94
 
95
95
  DESC
@@ -265,11 +265,11 @@ module Libis
265
265
  end
266
266
 
267
267
  def extname(format)
268
- Libis::Format::TypeDatabase.type_extentions(format).first
268
+ Libis::Format::Library.get_field(format, :extensions)
269
269
  end
270
270
 
271
271
  def get_format(file_name)
272
- Libis::Format::TypeDatabase.ext_types(File.extname(file_name)).first
272
+ Libis::Format::Library.get_field_by(:extension, File.extname(file_name), :format)
273
273
  end
274
274
 
275
275
  def format_identifier(file)
@@ -1,5 +1,6 @@
1
1
  # encoding: utf-8
2
2
  require 'os'
3
+ require 'libis-tools'
3
4
 
4
5
  module Libis
5
6
  module Format
@@ -23,23 +24,26 @@ module Libis
23
24
  Config[:preflight_jar] = File.join(Libis::Format::TOOL_DIR, 'pdfbox', 'preflight-app-2.0.13.jar')
24
25
  # noinspection RubyStringKeysInHashInspection
25
26
  Config[:xml_validations] = [['archive/ead', File.join(Libis::Format::DATA_DIR, 'ead.xsd')]]
26
- Config[:type_database] = File.join(Libis::Format::DATA_DIR, 'types.yml')
27
+ Config[:format_library_implementation] = 'Libis::Format::YamlLoader.instance'
28
+ Config[:format_library_database] = File.join(Libis::Format::DATA_DIR, 'types.yml')
27
29
  Config[:raw_audio_convert_cmd] = 'sox -V1 %s -e signed -b 16 -t wav %s rate %d channels %d'
28
30
  Config[:watermark_font] = '/usr/share/fonts/truetype/liberation/LiberationSans-Regular.ttf'
29
31
  Config[:timeouts] = {
30
32
  droid: 20 * 60,
31
- ffmpeg: 5 * 60,
33
+ ffmpeg: 500 * 60,
32
34
  fido: 20 * 60,
33
- file_tool: 5 * 60,
34
- fop: 5 * 60,
35
- identification_tool: 5 * 60,
36
- office_to_pdf: 5 * 60,
37
- pdf_copy: 5 * 60,
38
- pdf_merge: 5 * 60,
39
- pdf_optimizer: 5 * 60,
40
- pdf_split: 5 * 60,
41
- pdf_to_pdfa: 5 * 60,
42
- pdfa_validator: 5 * 60,
35
+ file_tool: 20 * 60,
36
+ fop: 50 * 60,
37
+ identification_tool: 50 * 60,
38
+ office_to_pdf: 50 * 60,
39
+ pdf_select: 50 * 60,
40
+ pdf_copy: 50 * 60,
41
+ pdf_merge: 50 * 60,
42
+ pdf_optimizer: 50 * 60,
43
+ pdf_split: 50 * 60,
44
+ pdf_watermark: 50 * 60,
45
+ pdf_to_pdfa: 50 * 60,
46
+ pdfa_validator: 50 * 60,
43
47
  }
44
48
 
45
49
  end
@@ -15,7 +15,7 @@ module Libis
15
15
  end
16
16
 
17
17
  def self.output_types(format = nil)
18
- return [] unless input_types.include?(format)
18
+ return [] unless format.nil? || input_types.include?(format)
19
19
  [:MP3, :FLAC, :AC3, :AAC, :WMA, :ALAC, :WAV, :AIFF, :AMR, :AU, :M4A]
20
20
  end
21
21
 
@@ -69,47 +69,13 @@ module Libis
69
69
  (@options[:preset] ||= {})[stream] = name
70
70
  end
71
71
 
72
- # def encoder(value)
73
- # @options[:encoder] = value
74
- # end
75
- #
76
- # def encoder_options(value)
77
- # @options[:encoder_options] = value
78
- # end
79
-
80
72
  def convert(source, target, _format, opts = {})
81
73
  super
82
74
 
83
75
  FileUtils.mkpath(File.dirname(target))
84
76
 
85
- if source.is_a? Array
86
-
87
- assemble_and_convert(source, target)
88
-
89
- elsif File.directory?(source)
90
-
91
- sources = Dir[File.join(source, '**', '*')].reject {|p| File.directory? p}
92
- assemble_and_convert(sources, target)
77
+ convert_file(source, target)
93
78
 
94
- else
95
-
96
- convert_file(source, target)
97
-
98
- end
99
-
100
- target
101
-
102
- end
103
-
104
- def assemble_and_convert(sources, target)
105
- Tempfile.create(%w(list .txt)) do |f|
106
- sources.each {|src| f.puts src}
107
- opts[:global] ||= []
108
- opts[:global] += %w(-f concat)
109
- f.close
110
- target = convert_file(f.to_path, target)
111
- end
112
- target
113
79
  end
114
80
 
115
81
  def self.sounds_like(file1, file2, threshold, rate, channels)
@@ -4,7 +4,8 @@
4
4
  require 'tmpdir'
5
5
  require 'libis/tools/logger'
6
6
  require 'libis/tools/temp_file'
7
- require 'libis/format/type_database'
7
+ require 'libis/tools/extend/string'
8
+ require 'libis/format/library'
8
9
 
9
10
  require_relative 'repository'
10
11
 
@@ -22,10 +23,23 @@ module Libis
22
23
  @flags = {}
23
24
  end
24
25
 
26
+ def self.category
27
+ :converter
28
+ end
29
+
30
+ def check_file_exist(file)
31
+ unless File.exist? file
32
+ error "Cannot find file '#{file}'."
33
+ return false
34
+ end
35
+ true
36
+ end
37
+
25
38
  def convert(source, target, format, opts = {})
26
- unless File.exist? source
27
- error "Cannot find file '#{source}'."
28
- return nil
39
+ if source.is_a?(Array)
40
+ return nil unless source.map { |f| check_file_exist(f) }.reduce(:&)
41
+ else
42
+ return nil unless check_file_exist(source)
29
43
  end
30
44
  @options.merge!(opts[:options]) if opts[:options]
31
45
  @flags.merge!(opts[:flags]) if opts[:flags]
@@ -51,7 +65,7 @@ module Libis
51
65
  target
52
66
  end
53
67
 
54
- def Base.inherited( klass )
68
+ def Base.inherited(klass)
55
69
 
56
70
  Repository.register klass
57
71
 
@@ -73,12 +87,12 @@ module Libis
73
87
  end
74
88
 
75
89
  def input_mimetype?(mimetype)
76
- type_id = TypeDatabase.instance.mime_types(mimetype).first
90
+ type_id = Libis::Format::Library.get_field_by(:mimetype, mimetype, :format)
77
91
  input_type? type_id
78
92
  end
79
93
 
80
94
  def output_mimetype?(mimetype)
81
- type_id = TypeDatabase.instance.mime_types(mimetype).first
95
+ type_id = Libis::Format::Library.get_field_by(:mimetype, mimetype, :format)
82
96
  output_type? type_id
83
97
  end
84
98
 
@@ -91,7 +105,7 @@ module Libis
91
105
  end
92
106
 
93
107
  def extension?(extension)
94
- !TypeDatabase.ext_types(extension).first.nil?
108
+ !Libis::Format::Library.get_field_by(:extension, extension, :format).nil?
95
109
  end
96
110
 
97
111
  end