libis-format 1.2.9 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/.coveralls.yml +2 -0
  3. data/.gitignore +20 -0
  4. data/.travis.yml +70 -0
  5. data/Gemfile +0 -8
  6. data/README.md +2 -2
  7. data/Rakefile +8 -0
  8. data/base/Dockerfile +35 -0
  9. data/base/Dockerfile.alpine +20 -0
  10. data/base/Dockerfile.rvm +56 -0
  11. data/base/rework_path +20 -0
  12. data/data/PDFA_def.ps +3 -3
  13. data/data/eciRGB_v2.icc +0 -0
  14. data/data/types.yml +3 -16
  15. data/docker_cfg.yml +1 -0
  16. data/lib/libis/format/cli/convert.rb +4 -4
  17. data/lib/libis/format/cli/prompt_helper.rb +24 -32
  18. data/lib/libis/format/config.rb +4 -3
  19. data/lib/libis/format/converter/audio_converter.rb +31 -56
  20. data/lib/libis/format/converter/base.rb +21 -8
  21. data/lib/libis/format/converter/chain.rb +6 -18
  22. data/lib/libis/format/converter/fop_pdf_converter.rb +2 -0
  23. data/lib/libis/format/converter/image_assembler.rb +82 -0
  24. data/lib/libis/format/converter/image_converter.rb +21 -141
  25. data/lib/libis/format/converter/image_splitter.rb +80 -0
  26. data/lib/libis/format/converter/image_watermarker.rb +261 -0
  27. data/lib/libis/format/converter/jp2_converter.rb +4 -4
  28. data/lib/libis/format/converter/office_converter.rb +5 -3
  29. data/lib/libis/format/converter/pdf_assembler.rb +66 -0
  30. data/lib/libis/format/converter/pdf_converter.rb +31 -98
  31. data/lib/libis/format/converter/pdf_optimizer.rb +70 -0
  32. data/lib/libis/format/converter/pdf_splitter.rb +65 -0
  33. data/lib/libis/format/converter/pdf_watermarker.rb +110 -0
  34. data/lib/libis/format/converter/spreadsheet_converter.rb +5 -3
  35. data/lib/libis/format/converter/video_converter.rb +3 -6
  36. data/lib/libis/format/converter/xslt_converter.rb +14 -15
  37. data/lib/libis/format/identifier.rb +4 -4
  38. data/lib/libis/format/info.rb +27 -0
  39. data/lib/libis/format/library.rb +147 -0
  40. data/lib/libis/format/tool/extension_identification.rb +26 -24
  41. data/lib/libis/format/tool/{ff_mpeg.rb → ffmpeg.rb} +1 -10
  42. data/lib/libis/format/tool/fido.rb +27 -22
  43. data/lib/libis/format/tool/file_tool.rb +24 -11
  44. data/lib/libis/format/tool/fop_pdf.rb +14 -25
  45. data/lib/libis/format/tool/identification_tool.rb +40 -38
  46. data/lib/libis/format/tool/office_to_pdf.rb +18 -30
  47. data/lib/libis/format/tool/pdf_copy.rb +1 -11
  48. data/lib/libis/format/tool/pdf_merge.rb +1 -11
  49. data/lib/libis/format/tool/pdf_optimizer.rb +2 -11
  50. data/lib/libis/format/tool/pdf_split.rb +16 -25
  51. data/lib/libis/format/tool/pdf_to_pdfa.rb +32 -50
  52. data/lib/libis/format/tool/pdfa_validator.rb +30 -25
  53. data/lib/libis/format/tool/spreadsheet_to_ods.rb +2 -10
  54. data/lib/libis/format/tool.rb +1 -2
  55. data/lib/libis/format/version.rb +1 -3
  56. data/lib/libis/format/yaml_loader.rb +71 -0
  57. data/lib/libis/format.rb +5 -2
  58. data/libis-format.gemspec +18 -24
  59. metadata +78 -120
  60. data/data/AdobeRGB1998.icc +0 -0
  61. data/lib/libis/format/converter/email_converter.rb +0 -38
  62. data/lib/libis/format/tool/msg_to_pdf.rb +0 -270
  63. data/lib/libis/format/type_database.rb +0 -133
  64. data/lib/libis/format/type_database_impl.rb +0 -120
  65. data/tools/pdf2pdfa +0 -395
  66. /data/bin/{droid_tool → droid} +0 -0
  67. /data/bin/{fido_tool → fido} +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6c29bb20892b78bbab9995bdd7ce9e41510c58eaa3f6b63677d4decabd58fa3c
4
- data.tar.gz: ee9f707483006aef00181ca19ddb2db59f7b57cba73dcced0783651e6736b1e2
3
+ metadata.gz: f563ad694fd3d0c9e4a9f0da3309c99ac4b103e6027fcc9cda1606f0f67549c2
4
+ data.tar.gz: 5cee3f4b3bb1e51db492ee14bf919b0ce0fa69e267292380364c32b4eec40b4e
5
5
  SHA512:
6
- metadata.gz: 9df967f1e7548534c9f030d85e823af89c811501b28279ff390904f1ffccef27ecfc34467d5e858d1faa4b24fef018e2c5dc67a79041cebb80bdee02d0f1075d
7
- data.tar.gz: fa62cdcc7d6182bf9092af071e1657ac6dd41d47f1ad7327ac66d604e6df3218117f07745c16cbd8b45043901f79ee86ece53d735b223a850c84ad3a5306cff4
6
+ metadata.gz: 409ea1fac8f8be4d2519f189090207b6a550a1b1ce174a71fa1886c69b667001459d4bdccd850dd55373199ae5553ebd02183e15eebc88a73d0ac3f8093f7d12
7
+ data.tar.gz: d3e4d77ddcaab1f5050aaf4acb02e74a221566abedb94062254efbc24d18703c8fdd739644b1cd5435b54a4497e77c82bdcbcb218d121bfaf135e483662aca06
data/.coveralls.yml ADDED
@@ -0,0 +1,2 @@
1
+ service_name: travis-ci
2
+ repo_token: DRqohi64MRd8offoQKjjqqPlWV1vnm1mY
data/.gitignore ADDED
@@ -0,0 +1,20 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /spec/work/
10
+ /spec/tmp/
11
+ /tmp/
12
+ *.bundle
13
+ *.so
14
+ *.o
15
+ *.a
16
+ mkmf.log
17
+ /.idea/
18
+ *.pyc
19
+ tools/pdf/
20
+ /test*
data/.travis.yml ADDED
@@ -0,0 +1,70 @@
1
+ dist: bionic
2
+ language: ruby
3
+ cache: bundler
4
+ sudo: false
5
+ rvm:
6
+ - 2.3
7
+ - 2.4
8
+ - 2.5
9
+ - 2.6
10
+ - ruby-head
11
+ - jruby-9.1
12
+ - jruby-9.2
13
+ - jruby-head
14
+ jdk:
15
+ - openjdk10
16
+ - openjdk11
17
+ matrix:
18
+ exclude:
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
+ - rvm: ruby-head
28
+ jdk: openjdk10
29
+ allow_failures:
30
+ - rvm: ruby-head
31
+ - rvm: jruby-head
32
+ branches:
33
+ only:
34
+ - master
35
+ - v2
36
+ before_install:
37
+ - gem update --system
38
+ - gem --version
39
+ - sudo add-apt-repository ppa:mc3man/bionic-media -y
40
+ - sudo apt-get update -y -q
41
+ - sudo apt-get install
42
+ - sudo apt-get install -y -q ffmpeg ubuntu-restricted-extras
43
+ - sudo pip install --upgrade pip
44
+ - sudo pip install --upgrade --ignore-installed opf-fido six
45
+ - sudo wget -O droid.zip -q http://www.nationalarchives.gov.uk/documents/information-management/droid-binary-6.4-bin.zip
46
+ - sudo mkdir -p /opt/droid
47
+ - sudo unzip droid.zip -d /opt/droid
48
+ - sudo chmod 755 /opt/droid/droid.sh
49
+ - sudo locale-gen "en_US.UTF-8"
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
56
+ env:
57
+ - LC_ALL=en_US.UTF-8
58
+ - LANG=en_US.UTF-8
59
+ addons:
60
+ apt:
61
+ packages:
62
+ - python2.7
63
+ - imagemagick
64
+ - libreoffice
65
+ - ghostscript
66
+ - sox
67
+ - libsox-dev
68
+ - libsox-fmt-all
69
+ - libchromaprint-dev
70
+ - libchromaprint-tools
data/Gemfile CHANGED
@@ -1,13 +1,5 @@
1
- # frozen_string_literal: true
2
-
3
1
  source 'https://rubygems.org'
4
2
 
5
3
  gem 'coveralls', group: :test, require: false
6
4
 
7
5
  gemspec name: 'libis-format', development_group: :test
8
-
9
- group :development do
10
- gem 'byebug'
11
- gem 'debug'
12
- gem 'standard'
13
- end
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/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new
5
+
6
+ task :default => :spec
7
+
8
+
data/base/Dockerfile ADDED
@@ -0,0 +1,35 @@
1
+ FROM ubuntu:18.04
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
+
16
+ RUN pip install --upgrade pip && pip install opf-fido
17
+
18
+ RUN wget -q -O droid.zip "http://www.nationalarchives.gov.uk/documents/information-management/droid-binary-6.4-bin.zip" \
19
+ && mkdir -p /opt/droid \
20
+ && unzip -d /opt/droid droid.zip \
21
+ && chmod 755 /opt/droid/droid.sh \
22
+ && rm droid.zip
23
+
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" \
25
+ && mkdir -p /opt/fop \
26
+ && tar xzf fop.tar.gz -C /opt/fop --strip-components=2 \
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/data/PDFA_def.ps CHANGED
@@ -5,10 +5,10 @@
5
5
  % unless the user modifies the corresponding line below.
6
6
 
7
7
  % Define entries in the document Info dictionary :
8
- /ICCProfile ([**ICC profile**])
8
+ /ICCProfile ([** Fill in ICC profile location **])
9
9
  def
10
10
 
11
- [ [**METADATA**]
11
+ [ /Title (Title)
12
12
  /DOCINFO pdfmark
13
13
 
14
14
  % Define an ICC profile :
@@ -35,6 +35,6 @@ def
35
35
  /Type /OutputIntent % Must be so (the standard requires).
36
36
  /S /GTS_PDFA1 % Must be so (the standard requires).
37
37
  /DestOutputProfile {icc_PDFA} % Must be so (see above).
38
- /OutputConditionIdentifier ([**ICC reference**])
38
+ /OutputConditionIdentifier ([** Fill in ICC reference name **])
39
39
  >> /PUT pdfmark
40
40
  [{Catalog} <</OutputIntents [ {OutputIntent_PDFA} ]>> /PUT pdfmark
Binary file
data/data/types.yml CHANGED
@@ -96,14 +96,14 @@ AUDIO:
96
96
 
97
97
  AAC:
98
98
  NAME: Advanced Audio Coding (AAC)
99
- MIME: audio/aac audio/x-hx-aac-adts
99
+ MIME: audio/aac
100
100
  EXTENSIONS: aac
101
101
 
102
102
  WMA:
103
103
  NAME: Windows Media Audio (WMA)
104
104
  MIME: audio/x-ms-wma
105
105
  PUID: fmt/132
106
- EXTENSIONS: wma asf
106
+ EXTENSIONS: wma
107
107
 
108
108
  ALAC:
109
109
  NAME: Apple Lossless Audio Codec (ALAC)
@@ -194,7 +194,7 @@ VIDEO:
194
194
  NAME: Windows Media Video (WMV)
195
195
  MIME: video/x-ms-wmv
196
196
  PUID: fmt/133 fmt/441
197
- EXTENSIONS: wmv asf
197
+ EXTENSIONS: wmv
198
198
 
199
199
  DV:
200
200
  NAME: Digital Video (DV)
@@ -319,12 +319,6 @@ TEXT:
319
319
 
320
320
  TABULAR:
321
321
 
322
- CSV:
323
- NAME: Comma Separated Values
324
- MIME: text/csv
325
- PUID: x-fmt/18
326
- EXTENSIONS: csv
327
-
328
322
  MSXLS:
329
323
  NAME: Microsoft Excel Spreadsheet (XLS)
330
324
  MIME: application/vnd.ms-excel,application/msexcel
@@ -357,15 +351,8 @@ TABULAR:
357
351
 
358
352
  PRESENTATION:
359
353
 
360
- MSPPS:
361
- NAME: Microsoft Powerpoint Presentation Show
362
- PUID: x-fmt/87
363
- MIME: application/vnd.ms-powerpoint
364
- EXTENSIONS: pps
365
-
366
354
  MSPPT:
367
355
  NAME: Microsoft Powerpoint Presentation (PPT)
368
- PUID: fmt/181 fmt/179 fmt/1747 fmt/1748 x-fmt/88 fmt/125 fmt/126
369
356
  MIME: application/vnd.ms-powerpoint,application/mspowerpoint
370
357
  EXTENSIONS: ppt
371
358
 
data/docker_cfg.yml ADDED
@@ -0,0 +1 @@
1
+ :fop_jar: '/tools/fop.jar'
@@ -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,3 @@
1
- # frozen_string_literal: true
2
-
3
1
  require 'tty-prompt'
4
2
  require 'pastel'
5
3
 
@@ -7,6 +5,7 @@ module Libis
7
5
  module Format
8
6
  module Cli
9
7
  module PromptHelper
8
+
10
9
  attr_reader :prompt, :pastel
11
10
 
12
11
  def initialize(*args)
@@ -15,6 +14,8 @@ module Libis
15
14
  super
16
15
  end
17
16
 
17
+ protected
18
+
18
19
  private
19
20
 
20
21
  def index_of(list, value)
@@ -24,9 +25,7 @@ module Libis
24
25
  end
25
26
 
26
27
  def ask(question, bool: false, enum: nil, default: nil, mask: false)
27
- cmd = :ask
28
- args = [question]
29
- opts = {}
28
+ cmd, args, opts = :ask, [question], {}
30
29
  if enum
31
30
  cmd = :select
32
31
  args << enum
@@ -39,57 +38,50 @@ module Libis
39
38
  prompt.send(cmd, *args, opts)
40
39
  end
41
40
 
42
- def tree_select(path, question: nil, file: false, page_size: 22, filter: true, cycle: false, create: false, # rubocop:disable Metrics/ParameterLists
41
+ def tree_select(path, question: nil, file: false, page_size: 22, filter: true, cycle: false, create: false,
43
42
  default_choices: nil)
44
43
  path = Pathname.new(path) unless path.is_a? Pathname
45
44
 
46
45
  return path unless path.exist?
47
-
48
46
  path = path.realpath
49
47
 
50
48
  dirs = path.children.select(&:directory?).sort
51
49
  files = file ? path.children.select(&:file?).sort : []
52
50
 
53
51
  choices = []
54
- choices << { name: "Folder: #{path}", value: path, disabled: file ? '' : false }
52
+ choices << {name: "Folder: #{path}", value: path, disabled: file ? '' : false}
55
53
  choices += default_choices if default_choices
56
- if create
57
- choices << {
58
- name: '-- new directory --',
59
- value: lambda {
60
- new_name = prompt.ask('new directory name:', modify: :trim, required: true)
61
- new_path = path + new_name
62
- FileUtils.mkdir(new_path.to_path)
63
- new_path
64
- }
65
- }
54
+ choices << {name: '-- new directory --', value: -> do
55
+ new_name = prompt.ask('new directory name:', modify: :trim, required: true)
56
+ new_path = path + new_name
57
+ FileUtils.mkdir(new_path.to_path)
58
+ new_path
66
59
  end
60
+ } if create
67
61
 
68
- if file && create
69
- choices << {
70
- name: '-- new file --', value: lambda {
71
- new_name = prompt.ask('new file name:', modify: :trim, required: true)
72
- path + new_name
73
- }
74
- }
62
+ choices << {name: "-- new file --", value: -> do
63
+ new_name = prompt.ask('new file name:', modify: :trim, required: true)
64
+ path + new_name
75
65
  end
66
+ } if file && create
76
67
 
77
- choices << { name: '[..]', value: path.parent }
68
+ choices << {name: '[..]', value: path.parent}
78
69
 
79
- dirs.each { |d| choices << { name: "[#{d.basename}]", value: d } }
80
- files.each { |f| choices << { name: f.basename.to_path, value: f } }
70
+ dirs.each {|d| choices << {name: "[#{d.basename}]", value: d}}
71
+ files.each {|f| choices << {name: f.basename.to_path, value: f}}
81
72
 
82
73
  question ||= "Select #{'file or ' if files}directory"
83
74
  selection = prompt.select question, choices,
84
- per_page: page_size, filter:, cycle:, default: file ? 2 : 1
75
+ per_page: page_size, filter: filter, cycle: cycle, default: file ? 2 : 1
85
76
 
86
77
  return selection unless selection.is_a? Pathname
87
78
  return selection.to_path if selection == path || selection.file?
88
79
 
89
- tree_select selection, question:, file:, page_size:, filter:,
90
- cycle:, create:, default_choices:
80
+ tree_select selection, question: question, file: file, page_size: page_size, filter: filter,
81
+ cycle: cycle, create: create, default_choices: default_choices
91
82
  end
83
+
92
84
  end
93
85
  end
94
86
  end
95
- end
87
+ end
@@ -5,6 +5,7 @@ require 'libis-tools'
5
5
  module Libis
6
6
  module Format
7
7
 
8
+ # noinspection RubyConstantNamingConvention
8
9
  Config = ::Libis::Tools::Config
9
10
 
10
11
  Config[:converter_chain_max_level] = 8
@@ -21,9 +22,10 @@ module Libis
21
22
  Config[:fido_formats] = [(File.join(Libis::Format::DATA_DIR, 'lias_formats.xml'))]
22
23
  Config[:pdf_tool] = File.join(Libis::Format::TOOL_DIR, 'PdfTool.jar')
23
24
  Config[:preflight_jar] = File.join(Libis::Format::TOOL_DIR, 'pdfbox', 'preflight-app-2.0.13.jar')
24
- Config[:wkhtmltopdf] = 'wkhtmltopdf'
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] = {
@@ -34,7 +36,6 @@ module Libis
34
36
  fop: 5 * 60,
35
37
  identification_tool: 5 * 60,
36
38
  office_to_pdf: 5 * 60,
37
- email2pdf: 5 * 60,
38
39
  pdf_copy: 5 * 60,
39
40
  pdf_merge: 5 * 60,
40
41
  pdf_optimizer: 5 * 60,