hydra-derivatives 3.7.0 → 3.8.0

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.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +27 -12
  3. data/.lando.yml +27 -0
  4. data/.rubocop.yml +3 -2
  5. data/CONTRIBUTING.md +8 -8
  6. data/Gemfile +1 -3
  7. data/README.md +4 -6
  8. data/Rakefile +0 -2
  9. data/VERSION +1 -1
  10. data/hydra-derivatives.gemspec +8 -8
  11. data/lib/hydra/derivatives/audio_encoder.rb +1 -0
  12. data/lib/hydra/derivatives/config.rb +1 -0
  13. data/lib/hydra/derivatives/io_decorator.rb +2 -1
  14. data/lib/hydra/derivatives/logger.rb +4 -3
  15. data/lib/hydra/derivatives/processors/active_encode.rb +1 -0
  16. data/lib/hydra/derivatives/processors/audio.rb +1 -0
  17. data/lib/hydra/derivatives/processors/ffmpeg.rb +1 -0
  18. data/lib/hydra/derivatives/processors/image.rb +2 -1
  19. data/lib/hydra/derivatives/processors/jpeg2k_image.rb +3 -3
  20. data/lib/hydra/derivatives/processors/processor.rb +1 -0
  21. data/lib/hydra/derivatives/processors/raw_image.rb +1 -0
  22. data/lib/hydra/derivatives/processors/shell_based_processor.rb +10 -3
  23. data/lib/hydra/derivatives/processors/video/config.rb +5 -4
  24. data/lib/hydra/derivatives/processors/video/processor.rb +21 -3
  25. data/lib/hydra/derivatives/processors/video.rb +1 -0
  26. data/lib/hydra/derivatives/processors.rb +1 -0
  27. data/lib/hydra/derivatives/runners/active_encode_derivatives.rb +1 -0
  28. data/lib/hydra/derivatives/runners/audio_derivatives.rb +1 -0
  29. data/lib/hydra/derivatives/runners/document_derivatives.rb +1 -0
  30. data/lib/hydra/derivatives/runners/full_text_extract.rb +1 -0
  31. data/lib/hydra/derivatives/runners/image_derivatives.rb +1 -0
  32. data/lib/hydra/derivatives/runners/jpeg2k_image_derivatives.rb +1 -0
  33. data/lib/hydra/derivatives/runners/pdf_derivatives.rb +1 -0
  34. data/lib/hydra/derivatives/runners/runner.rb +1 -0
  35. data/lib/hydra/derivatives/runners/video_derivatives.rb +1 -0
  36. data/lib/hydra/derivatives/services/capability_service.rb +1 -0
  37. data/lib/hydra/derivatives/services/mime_type_service.rb +1 -0
  38. data/lib/hydra/derivatives/services/persist_basic_contained_output_file_service.rb +1 -0
  39. data/lib/hydra/derivatives/services/persist_external_file_output_file_service.rb +1 -0
  40. data/lib/hydra/derivatives/services/persist_output_file_service.rb +1 -0
  41. data/lib/hydra/derivatives/services/remote_source_file.rb +1 -0
  42. data/lib/hydra/derivatives/services/retrieve_source_file_service.rb +1 -0
  43. data/lib/hydra/derivatives/services/tempfile_service.rb +1 -0
  44. data/lib/hydra/derivatives.rb +1 -0
  45. metadata +38 -112
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f166ed40726101e7aa7fb31658fae5fb49ba0f7ccfffb1cf6483db8f42bdb4b4
4
- data.tar.gz: 35adb95884a58ac12e2e4dce006c1052d9adab7e4e96db5afdfd642c86c04fc1
3
+ metadata.gz: 2b9642a74101fb1b816e9b1a6e994065991930c6d3fe51a48f698275b11291c8
4
+ data.tar.gz: 3b4f2505d50372b3d52318deefaab4586028e48d3f6820c9179c1c747a7e4c2b
5
5
  SHA512:
6
- metadata.gz: 88b362ab8c8bc24afa2c6bf393f94b5d5219490b342e25ca0e94e49d26d4f633245115bb37bff976b66c02a5ccaa0f4bc5dd58242fd2615cdd281687a6c70a50
7
- data.tar.gz: 7a12d4807489a306dc6667baedb51b4e56c492e7f2a4b15887f44af84e0de37fcb0511ebf1335608ac35983719382a73c3cda9545879e4f4199454e8465c7a28
6
+ metadata.gz: e9cdbf207aca051db6a3d281e7e019df5be05f4fa0b5f6e1c65b64cb6e3388c8838d9cd13991e7b1f740b1c79dbbd65b782dea3d7e5661a5bcdcd07c40bd540b
7
+ data.tar.gz: d96492b3804b2f19effc7aa5c0de247080324c036efea58e34c7db7e1888ff14af9010654da8afd0ffbf9b62262359f208cb1458faef18785f40f9fbc9d25758
data/.circleci/config.yml CHANGED
@@ -15,6 +15,15 @@ jobs:
15
15
  solr_version: 7-slim
16
16
  steps:
17
17
  - samvera/cached_checkout
18
+ - run:
19
+ name: Check for a branch named 'master'
20
+ command: |
21
+ git fetch --all --quiet --prune --prune-tags
22
+ if [[ -n "$(git branch --all --list master */master)" ]]; then
23
+ echo "A branch named 'master' was found. Please remove it."
24
+ echo "$(git branch --all --list master */master)"
25
+ fi
26
+ [[ -z "$(git branch --all --list master */master)" ]]
18
27
  - run:
19
28
  name: Install dependencies
20
29
  command: |
@@ -66,14 +75,17 @@ workflows:
66
75
  ci:
67
76
  jobs:
68
77
  - bundle_lint_test:
69
- name: ruby2-7
70
- ruby_version: 2.7.5
78
+ name: ruby3-2
79
+ ruby_version: 3.2.0
80
+ - bundle_lint_test:
81
+ name: ruby3-1
82
+ ruby_version: 3.1.3
71
83
  - bundle_lint_test:
72
- name: ruby2-6
73
- ruby_version: 2.6.9
84
+ name: ruby3-0
85
+ ruby_version: 3.0.3
74
86
  - bundle_lint_test:
75
- name: ruby2-5
76
- ruby_version: 2.5.9
87
+ name: ruby2-7
88
+ ruby_version: 2.7.7
77
89
 
78
90
  nightly:
79
91
  triggers:
@@ -85,11 +97,14 @@ workflows:
85
97
  - main
86
98
  jobs:
87
99
  - bundle_lint_test:
88
- name: ruby2-7
89
- ruby_version: 2.7.5
100
+ name: ruby3-2
101
+ ruby_version: 3.2.0
90
102
  - bundle_lint_test:
91
- name: ruby2-6
92
- ruby_version: 2.6.9
103
+ name: ruby3-1
104
+ ruby_version: 3.1.3
93
105
  - bundle_lint_test:
94
- name: ruby2-5
95
- ruby_version: 2.5.9
106
+ name: ruby3-0
107
+ ruby_version: 3.0.3
108
+ - bundle_lint_test:
109
+ name: ruby2-7
110
+ ruby_version: 2.7.7
data/.lando.yml ADDED
@@ -0,0 +1,27 @@
1
+ name: hydra_derivatives
2
+ services:
3
+ fcrepo4:
4
+ type: compose
5
+ app_mount: false
6
+ portforward: true
7
+ volumes:
8
+ fcrepo4:
9
+ services:
10
+ image: samvera/fcrepo4:4.7.5
11
+ command: /fedora-entrypoint.sh
12
+ volumes:
13
+ - fcrepo4:/data
14
+ ports:
15
+ - 8986:8080
16
+ solr:
17
+ type: solr:7
18
+ app_mount: false
19
+ portforward: 8985
20
+ core: hydra-test
21
+ config:
22
+ dir: solr/config
23
+ proxy:
24
+ fcrepo4:
25
+ - hydra-derivatives.fcrepo4.lndo.site:8986
26
+ solr:
27
+ - hydra-derivatives.solr.lndo.site:8985
data/.rubocop.yml CHANGED
@@ -1,4 +1,5 @@
1
- require: rubocop-rspec
1
+ inherit_gem:
2
+ bixby: bixby_default.yml
2
3
  inherit_from: .rubocop_todo.yml
3
4
 
4
5
  AllCops:
@@ -12,7 +13,7 @@ AllCops:
12
13
  - Rakefile
13
14
 
14
15
  Layout/IndentationConsistency:
15
- EnforcedStyle: rails
16
+ EnforcedStyle: indented_internal_methods
16
17
 
17
18
  Metrics/AbcSize:
18
19
  Max: 42
data/CONTRIBUTING.md CHANGED
@@ -45,10 +45,10 @@ You should also add yourself to the `CONTRIBUTORS.md` file in the root of the pr
45
45
 
46
46
  * Fork the repository on GitHub
47
47
  * Create a topic branch from where you want to base your work.
48
- * This is usually the master branch.
49
- * To quickly create a topic branch based on master; `git branch fix/master/my_contribution master`
50
- * Then checkout the new branch with `git checkout fix/master/my_contribution`.
51
- * Please avoid working directly on the `master` branch.
48
+ * This is usually the main branch.
49
+ * To quickly create a topic branch based on main; `git branch fix/main/my_contribution main`
50
+ * Then checkout the new branch with `git checkout fix/main/my_contribution`.
51
+ * Please avoid working directly on the `main` branch.
52
52
  * You may find the [hub suite of commands](https://github.com/defunkt/hub) helpful
53
53
  * Make sure you have added sufficient tests and documentation for your changes.
54
54
  * Test functionality with RSpec; Test features / UI with Capybara.
@@ -109,15 +109,15 @@ You should also add yourself to the `CONTRIBUTORS.md` file in the root of the pr
109
109
  ### Submitting Changes
110
110
 
111
111
  * Read the article ["Using Pull Requests"](https://help.github.com/articles/using-pull-requests) on GitHub.
112
- * Make sure your branch is up to date with its parent branch (i.e. master)
113
- * `git checkout master`
112
+ * Make sure your branch is up to date with its parent branch (i.e. main)
113
+ * `git checkout main`
114
114
  * `git pull --rebase`
115
115
  * `git checkout <your-branch>`
116
- * `git rebase master`
116
+ * `git rebase main`
117
117
  * It is a good idea to run your tests again.
118
118
  * If you've made more than one commit take a moment to consider whether squashing commits together would help improve their logical grouping.
119
119
  * [Detailed Walkthrough of One Pull Request per Commit](http://ndlib.github.io/practices/one-commit-per-pull-request/)
120
- * `git rebase --interactive master` ([See Github help](https://help.github.com/articles/interactive-rebase))
120
+ * `git rebase --interactive main` ([See Github help](https://help.github.com/articles/interactive-rebase))
121
121
  * Squashing your branch's changes into one commit is "good form" and helps the person merging your request to see everything that is going on.
122
122
  * Push your changes to a topic branch in your fork of the repository.
123
123
  * Submit a pull request from your fork to the project.
data/Gemfile CHANGED
@@ -6,9 +6,7 @@ gemspec
6
6
  gem 'sprockets', '~> 3.7'
7
7
 
8
8
  group :development, :test do
9
- gem 'coveralls'
9
+ gem 'bixby'
10
10
  gem 'rspec_junit_formatter'
11
- gem 'rubocop', '~> 0.52.0', require: false
12
- gem 'rubocop-rspec', require: false
13
11
  gem 'simplecov'
14
12
  end
data/README.md CHANGED
@@ -3,13 +3,13 @@
3
3
  Code:
4
4
  [![Version](https://badge.fury.io/rb/hydra-derivatives.png)](http://badge.fury.io/rb/hydra-derivatives)
5
5
  [![Build Status](https://circleci.com/gh/samvera/hydra-derivatives.svg?style=svg)](https://circleci.com/gh/samvera/hydra-derivatives)
6
- [![Coverage Status](https://coveralls.io/repos/github/samvera/hydra-derivatives/badge.svg?branch=master)](https://coveralls.io/github/samvera/hydra-derivatives?branch=master)
6
+ [![Coverage Status](https://coveralls.io/repos/github/samvera/hydra-derivatives/badge.svg?branch=main)](https://coveralls.io/github/samvera/hydra-derivatives?branch=main)
7
7
 
8
8
  Docs:
9
9
  [![Contribution Guidelines](http://img.shields.io/badge/CONTRIBUTING-Guidelines-blue.svg)](./CONTRIBUTING.md)
10
10
  [![Apache 2.0 License](http://img.shields.io/badge/APACHE2-license-blue.svg)](./LICENSE.txt)
11
11
 
12
- [Join us on slack!](http://slack.samvera.org/)
12
+ Community Support: [![Samvera Community Slack](https://img.shields.io/badge/samvera-slack-blueviolet)](http://slack.samvera.org/)
13
13
 
14
14
  # What is hydra-derivatives?
15
15
 
@@ -17,13 +17,11 @@ Derivative generation for Samvera applications.
17
17
 
18
18
  ## Product Owner & Maintenance
19
19
 
20
- **hydra-derivatives** is a Core Component of the Samvera community. The documentation for
21
- what this means can be found
22
- [here](http://samvera.github.io/core_components.html#requirements-for-a-core-component).
20
+ `hydra-derivatives` is a Core Component of the Samvera Community. The documentation for what this means can be found [here](http://samvera.github.io/core_components.html#requirements-for-a-core-component).
23
21
 
24
22
  ### Product Owner
25
23
 
26
- [jenlindner](https://github.com/jenlindner)
24
+ [stkenny](https://github.com/stkenny)
27
25
 
28
26
  # Help
29
27
 
data/Rakefile CHANGED
@@ -2,8 +2,6 @@
2
2
 
3
3
  require "bundler/gem_tasks"
4
4
 
5
- # Dir.glob('tasks/*.rake').each { |r| import r }
6
-
7
5
  require 'rspec/core/rake_task'
8
6
  RSpec::Core::RakeTask.new(:spec)
9
7
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.7.0
1
+ 3.8.0
@@ -9,6 +9,7 @@ Gem::Specification.new do |spec|
9
9
  spec.summary = "Derivative generation plugin for hydra"
10
10
  spec.license = "APACHE2"
11
11
  spec.homepage = "https://github.com/projecthydra/hydra-derivatives"
12
+ spec.metadata = { "rubygems_mfa_required" => "true" }
12
13
 
13
14
  spec.files = `git ls-files`.split($OUTPUT_RECORD_SEPARATOR).select { |f| File.dirname(f) !~ %r{\A"?spec|test|features\/?} }
14
15
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
@@ -17,16 +18,15 @@ Gem::Specification.new do |spec|
17
18
  spec.add_development_dependency 'bundler', '~> 2.1'
18
19
  spec.add_development_dependency 'fcrepo_wrapper', '~> 0.2'
19
20
  spec.add_development_dependency 'pry-byebug'
20
- spec.add_development_dependency 'rails', '> 5.1', '< 7.0'
21
- spec.add_development_dependency 'rake', '~> 10.1'
21
+ spec.add_development_dependency 'rails', '> 5.1', '< 7.1'
22
+ spec.add_development_dependency 'rake'
22
23
  spec.add_development_dependency 'rspec', '~> 3.1'
23
- spec.add_development_dependency "solr_wrapper", "~> 2.0"
24
+ spec.add_development_dependency "solr_wrapper"
24
25
 
25
- spec.add_dependency 'active-fedora', '>= 11.5.6',
26
- '!= 12.0.0', '!= 12.0.1', '!= 12.0.2', '!= 12.0.3', '!= 12.1.0', '!= 12.1.1', '!= 12.2.0', '!= 12.2.1',
27
- '!= 13.0.0', '!= 13.1.0', '!= 13.1.1', '!= 13.1.2', '!= 13.1.3', '!= 13.2.0', '!= 13.2.1'
28
- spec.add_dependency 'active_encode', '~>0.1'
29
- spec.add_dependency 'activesupport', '>= 4.0', '< 7'
26
+ spec.add_dependency 'active_encode', '~> 0.1'
27
+ spec.add_dependency 'active-fedora', '>= 14.0'
28
+ spec.add_dependency 'active-triples', '>= 1.2'
29
+ spec.add_dependency 'activesupport', '>= 4.0', '< 7.1'
30
30
  spec.add_dependency 'addressable', '~> 2.5'
31
31
  spec.add_dependency 'deprecation'
32
32
  spec.add_dependency 'mime-types', '> 2.0', '< 4.0'
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'open3'
2
3
 
3
4
  module Hydra::Derivatives
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'tmpdir'
2
3
 
3
4
  module Hydra
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  # Naive implementation of IO wrapper class that adds mime_type and original_filename
2
3
  # attributes. This is done to match the interface of ActionDispatch::HTTP::UploadedFile
3
4
  # so the attributes do not have to be passed as additional arguments, and are attached
@@ -16,7 +17,7 @@ module Hydra
16
17
  alias original_name original_filename
17
18
  deprecation_deprecate original_name: 'original_name has been deprecated. Use original_filename instead. This will be removed in hydra-derivatives 4.0'
18
19
  alias original_name= original_filename=
19
- deprecation_deprecate :"original_name=" => 'original_name= has been deprecated. Use original_filename= instead. This will be removed in hydra-derivatives 4.0'
20
+ deprecation_deprecate "original_name=": 'original_name= has been deprecated. Use original_filename= instead. This will be removed in hydra-derivatives 4.0'
20
21
 
21
22
  def initialize(file, mime_type = nil, original_filename = nil)
22
23
  super(file)
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Hydra::Derivatives
2
3
  class Logger
3
4
  class << self
@@ -17,9 +18,9 @@ module Hydra::Derivatives
17
18
 
18
19
  private
19
20
 
20
- def logger
21
- ActiveFedora::Base.logger || ::Logger.new(STDOUT)
22
- end
21
+ def logger
22
+ ActiveFedora::Base.logger || ::Logger.new(STDOUT)
23
+ end
23
24
  end
24
25
  end
25
26
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'active_encode'
2
3
 
3
4
  module Hydra::Derivatives::Processors
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Hydra::Derivatives::Processors
2
3
  class Audio < Processor
3
4
  include Ffmpeg
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  # An abstract class for asyncronous jobs that transcode files using FFMpeg
2
3
  module Hydra::Derivatives::Processors
3
4
  module Ffmpeg
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'mini_magick'
2
3
 
3
4
  module Hydra::Derivatives::Processors
@@ -61,7 +62,7 @@ module Hydra::Derivatives::Processors
61
62
  end
62
63
 
63
64
  def selected_layers(image)
64
- if image.type =~ /pdf/i
65
+ if /pdf/i.match?(image.type)
65
66
  image.layers[directives.fetch(:layer, 0)]
66
67
  elsif directives.fetch(:layer, false)
67
68
  image.layers[directives.fetch(:layer)]
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'mini_magick'
2
3
  require 'nokogiri'
3
4
 
@@ -50,6 +51,7 @@ module Hydra::Derivatives::Processors
50
51
  end
51
52
 
52
53
  def level_count_for_size(long_dim)
54
+ return 0 if long_dim < 96
53
55
  levels = 0
54
56
  level_size = long_dim
55
57
  while level_size >= 96
@@ -90,9 +92,7 @@ module Hydra::Derivatives::Processors
90
92
  long_dim = self.class.long_dim(image)
91
93
  file_path = self.class.tmp_file('.tif')
92
94
  to_srgb = directives.fetch(:to_srgb, true)
93
- if directives[:resize] || to_srgb
94
- preprocess(image, resize: directives[:resize], to_srgb: to_srgb, src_quality: quality)
95
- end
95
+ preprocess(image, resize: directives[:resize], to_srgb: to_srgb, src_quality: quality) if directives[:resize] || to_srgb
96
96
  image.write file_path
97
97
  recipe = self.class.kdu_compress_recipe(directives, quality, long_dim)
98
98
  encode_file(recipe, file_path: file_path)
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Hydra::Derivatives::Processors
2
3
  # Processors take a single input and produce a single output
3
4
  class Processor
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'mini_magick'
2
3
 
3
4
  module Hydra::Derivatives::Processors
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  # An abstract class for asyncronous jobs that transcode files using FFMpeg
2
3
 
3
4
  require 'tmpdir'
@@ -59,7 +60,7 @@ module Hydra::Derivatives::Processors
59
60
  end
60
61
 
61
62
  def execute_without_timeout(command, context)
62
- err_str = ''
63
+ error_buffer = ''
63
64
  stdin, stdout, stderr, wait_thr = popen3(command)
64
65
  context[:pid] = wait_thr[:pid]
65
66
  files = [stderr, stdout]
@@ -78,8 +79,14 @@ module Hydra::Derivatives::Processors
78
79
 
79
80
  case fileno
80
81
  when stderr.fileno
81
- err_str << data
82
+ updated_error_buffer = error_buffer.dup
83
+ updated_error_buffer << data
84
+ error_buffer = updated_error_buffer
82
85
  end
86
+ rescue IO::WaitReadable
87
+ Hydra::Derivatives::Logger.warn "Caught an IO::WaitReadable error in ShellBasedProcessor. Retrying..."
88
+ IO.select([f], nil, nil, 60)
89
+ retry
83
90
  rescue EOFError
84
91
  Hydra::Derivatives::Logger.debug "Caught an eof error in ShellBasedProcessor"
85
92
  # No big deal.
@@ -91,7 +98,7 @@ module Hydra::Derivatives::Processors
91
98
  stderr.close
92
99
  exit_status = wait_thr.value
93
100
 
94
- raise "Unable to execute command \"#{command}\". Exit code: #{exit_status}\nError message: #{err_str}" unless exit_status.success?
101
+ raise "Unable to execute command \"#{command}\". Exit code: #{exit_status}\nError message: #{error_buffer}" unless exit_status.success?
95
102
  end
96
103
 
97
104
  def all_eof?(files)
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Hydra::Derivatives::Processors::Video
2
3
  class Config
3
4
  attr_writer :video_bitrate, :video_attributes, :size_attributes, :audio_attributes
@@ -45,16 +46,16 @@ module Hydra::Derivatives::Processors::Video
45
46
  attr_reader :codec
46
47
  end
47
48
 
49
+ def default_video_attributes(bitrate = video_bitrate)
50
+ "-g 30 -b:v #{bitrate}"
51
+ end
52
+
48
53
  protected
49
54
 
50
55
  def default_video_bitrate
51
56
  '345k'
52
57
  end
53
58
 
54
- def default_video_attributes
55
- "-g 30 -b:v #{video_bitrate}"
56
- end
57
-
58
59
  def default_size_attributes
59
60
  "320x240"
60
61
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Hydra::Derivatives::Processors
2
3
  module Video
3
4
  class Processor < Hydra::Derivatives::Processors::Processor
@@ -10,13 +11,13 @@ module Hydra::Derivatives::Processors
10
11
 
11
12
  def options_for(format)
12
13
  input_options = ""
13
- output_options = "-s #{config.size_attributes} #{codecs(format)}"
14
-
14
+ output_options = "-s #{size_attributes} #{codecs(format)}"
15
15
  if format == "jpg"
16
16
  input_options += " -itsoffset -2"
17
17
  output_options += " -vframes 1 -an -f rawvideo"
18
18
  else
19
- output_options += " #{config.video_attributes} #{config.audio_attributes}"
19
+ input_options += @directives[:input_options] if @directives[:input_options].present?
20
+ output_options += " #{video_attributes} #{audio_attributes}"
20
21
  end
21
22
 
22
23
  { Ffmpeg::OUTPUT_OPTIONS => output_options, Ffmpeg::INPUT_OPTIONS => input_options }
@@ -36,6 +37,23 @@ module Hydra::Derivatives::Processors
36
37
  raise ArgumentError, "Unknown format `#{format}'"
37
38
  end
38
39
  end
40
+
41
+ def size_attributes
42
+ @directives[:size].nil? ? config.size_attributes : @directives[:size]
43
+ end
44
+
45
+ def video_attributes
46
+ attrs = @directives[:video] if @directives[:video].present?
47
+ # If you have set Hydra::Derivatives::Processors::Video::Processor.config.video_attributes and want to customize the bitrate
48
+ # in the directives then you will need to pass the video parameter in the directives instead.
49
+ attrs ||= config.default_video_attributes(@directives[:bitrate]) if @directives[:bitrate].present?
50
+ attrs ||= config.video_attributes
51
+ attrs
52
+ end
53
+
54
+ def audio_attributes
55
+ @directives[:audio].nil? ? config.audio_attributes : @directives[:audio]
56
+ end
39
57
  end
40
58
  end
41
59
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Hydra::Derivatives::Processors
2
3
  module Video
3
4
  extend ActiveSupport::Autoload
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Hydra::Derivatives
2
3
  module Processors
3
4
  extend ActiveSupport::Autoload
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Hydra::Derivatives
2
3
  class ActiveEncodeDerivatives < Runner
3
4
  # @param [String, ActiveFedora::Base] object_or_filename source file name (or path), or an object that has a method that will return the file name
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Hydra::Derivatives
2
3
  class AudioDerivatives < Runner
3
4
  def self.processor_class
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Hydra::Derivatives
2
3
  class DocumentDerivatives < Runner
3
4
  def self.processor_class
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Hydra::Derivatives
2
3
  class FullTextExtract < ImageDerivatives
3
4
  # Adds format: 'txt' as the default to each of the directives
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Hydra::Derivatives
2
3
  class ImageDerivatives < Runner
3
4
  # Adds format: 'png' as the default to each of the directives
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Hydra::Derivatives
2
3
  class Jpeg2kImageDerivatives < Runner
3
4
  # # Adds format: 'png' as the default to each of the directives
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Hydra
2
3
  module Derivatives
3
4
  class PdfDerivatives < ImageDerivatives
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Hydra
2
3
  module Derivatives
3
4
  class Runner
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Hydra::Derivatives
2
3
  class VideoDerivatives < Runner
3
4
  def self.processor_class
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'open3'
2
3
 
3
4
  module Hydra::Derivatives
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'mime/types'
2
3
 
3
4
  module Hydra::Derivatives
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Hydra::Derivatives
2
3
  # This Service is an implementation of the Hydra::Derivatives::PeristOutputFileService
3
4
  # It supports basic contained files, which is the behavior associated with Fedora 3 file datastreams that were migrated to Fedora 4
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'addressable'
2
3
 
3
4
  module Hydra::Derivatives
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Hydra::Derivatives
2
3
  class PersistOutputFileService
3
4
  # Persists the file within the object at destination_name. Uses basic containment.
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  # For the case where the source file is a remote file, and we
2
3
  # don't want to download the file locally, just return the
3
4
  # file name or file path (or whatever we need to pass to the
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Hydra::Derivatives
2
3
  class RetrieveSourceFileService
3
4
  # Retrieves the source
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'mime/types'
2
3
 
3
4
  module Hydra::Derivatives
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'active_fedora'
2
3
  require 'deprecation'
3
4
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hydra-derivatives
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.7.0
4
+ version: 3.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Coyne
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-07-27 00:00:00.000000000 Z
11
+ date: 2023-02-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -61,7 +61,7 @@ dependencies:
61
61
  version: '5.1'
62
62
  - - "<"
63
63
  - !ruby/object:Gem::Version
64
- version: '7.0'
64
+ version: '7.1'
65
65
  type: :development
66
66
  prerelease: false
67
67
  version_requirements: !ruby/object:Gem::Requirement
@@ -71,21 +71,21 @@ dependencies:
71
71
  version: '5.1'
72
72
  - - "<"
73
73
  - !ruby/object:Gem::Version
74
- version: '7.0'
74
+ version: '7.1'
75
75
  - !ruby/object:Gem::Dependency
76
76
  name: rake
77
77
  requirement: !ruby/object:Gem::Requirement
78
78
  requirements:
79
- - - "~>"
79
+ - - ">="
80
80
  - !ruby/object:Gem::Version
81
- version: '10.1'
81
+ version: '0'
82
82
  type: :development
83
83
  prerelease: false
84
84
  version_requirements: !ruby/object:Gem::Requirement
85
85
  requirements:
86
- - - "~>"
86
+ - - ">="
87
87
  - !ruby/object:Gem::Version
88
- version: '10.1'
88
+ version: '0'
89
89
  - !ruby/object:Gem::Dependency
90
90
  name: rspec
91
91
  requirement: !ruby/object:Gem::Requirement
@@ -104,134 +104,58 @@ dependencies:
104
104
  name: solr_wrapper
105
105
  requirement: !ruby/object:Gem::Requirement
106
106
  requirements:
107
- - - "~>"
107
+ - - ">="
108
108
  - !ruby/object:Gem::Version
109
- version: '2.0'
109
+ version: '0'
110
110
  type: :development
111
111
  prerelease: false
112
+ version_requirements: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - ">="
115
+ - !ruby/object:Gem::Version
116
+ version: '0'
117
+ - !ruby/object:Gem::Dependency
118
+ name: active_encode
119
+ requirement: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - "~>"
122
+ - !ruby/object:Gem::Version
123
+ version: '0.1'
124
+ type: :runtime
125
+ prerelease: false
112
126
  version_requirements: !ruby/object:Gem::Requirement
113
127
  requirements:
114
128
  - - "~>"
115
129
  - !ruby/object:Gem::Version
116
- version: '2.0'
130
+ version: '0.1'
117
131
  - !ruby/object:Gem::Dependency
118
132
  name: active-fedora
119
133
  requirement: !ruby/object:Gem::Requirement
120
134
  requirements:
121
135
  - - ">="
122
136
  - !ruby/object:Gem::Version
123
- version: 11.5.6
124
- - - "!="
125
- - !ruby/object:Gem::Version
126
- version: 12.0.0
127
- - - "!="
128
- - !ruby/object:Gem::Version
129
- version: 12.0.1
130
- - - "!="
131
- - !ruby/object:Gem::Version
132
- version: 12.0.2
133
- - - "!="
134
- - !ruby/object:Gem::Version
135
- version: 12.0.3
136
- - - "!="
137
- - !ruby/object:Gem::Version
138
- version: 12.1.0
139
- - - "!="
140
- - !ruby/object:Gem::Version
141
- version: 12.1.1
142
- - - "!="
143
- - !ruby/object:Gem::Version
144
- version: 12.2.0
145
- - - "!="
146
- - !ruby/object:Gem::Version
147
- version: 12.2.1
148
- - - "!="
149
- - !ruby/object:Gem::Version
150
- version: 13.0.0
151
- - - "!="
152
- - !ruby/object:Gem::Version
153
- version: 13.1.0
154
- - - "!="
155
- - !ruby/object:Gem::Version
156
- version: 13.1.1
157
- - - "!="
158
- - !ruby/object:Gem::Version
159
- version: 13.1.2
160
- - - "!="
161
- - !ruby/object:Gem::Version
162
- version: 13.1.3
163
- - - "!="
164
- - !ruby/object:Gem::Version
165
- version: 13.2.0
166
- - - "!="
167
- - !ruby/object:Gem::Version
168
- version: 13.2.1
137
+ version: '14.0'
169
138
  type: :runtime
170
139
  prerelease: false
171
140
  version_requirements: !ruby/object:Gem::Requirement
172
141
  requirements:
173
142
  - - ">="
174
143
  - !ruby/object:Gem::Version
175
- version: 11.5.6
176
- - - "!="
177
- - !ruby/object:Gem::Version
178
- version: 12.0.0
179
- - - "!="
180
- - !ruby/object:Gem::Version
181
- version: 12.0.1
182
- - - "!="
183
- - !ruby/object:Gem::Version
184
- version: 12.0.2
185
- - - "!="
186
- - !ruby/object:Gem::Version
187
- version: 12.0.3
188
- - - "!="
189
- - !ruby/object:Gem::Version
190
- version: 12.1.0
191
- - - "!="
192
- - !ruby/object:Gem::Version
193
- version: 12.1.1
194
- - - "!="
195
- - !ruby/object:Gem::Version
196
- version: 12.2.0
197
- - - "!="
198
- - !ruby/object:Gem::Version
199
- version: 12.2.1
200
- - - "!="
201
- - !ruby/object:Gem::Version
202
- version: 13.0.0
203
- - - "!="
204
- - !ruby/object:Gem::Version
205
- version: 13.1.0
206
- - - "!="
207
- - !ruby/object:Gem::Version
208
- version: 13.1.1
209
- - - "!="
210
- - !ruby/object:Gem::Version
211
- version: 13.1.2
212
- - - "!="
213
- - !ruby/object:Gem::Version
214
- version: 13.1.3
215
- - - "!="
216
- - !ruby/object:Gem::Version
217
- version: 13.2.0
218
- - - "!="
219
- - !ruby/object:Gem::Version
220
- version: 13.2.1
144
+ version: '14.0'
221
145
  - !ruby/object:Gem::Dependency
222
- name: active_encode
146
+ name: active-triples
223
147
  requirement: !ruby/object:Gem::Requirement
224
148
  requirements:
225
- - - "~>"
149
+ - - ">="
226
150
  - !ruby/object:Gem::Version
227
- version: '0.1'
151
+ version: '1.2'
228
152
  type: :runtime
229
153
  prerelease: false
230
154
  version_requirements: !ruby/object:Gem::Requirement
231
155
  requirements:
232
- - - "~>"
156
+ - - ">="
233
157
  - !ruby/object:Gem::Version
234
- version: '0.1'
158
+ version: '1.2'
235
159
  - !ruby/object:Gem::Dependency
236
160
  name: activesupport
237
161
  requirement: !ruby/object:Gem::Requirement
@@ -241,7 +165,7 @@ dependencies:
241
165
  version: '4.0'
242
166
  - - "<"
243
167
  - !ruby/object:Gem::Version
244
- version: '7'
168
+ version: '7.1'
245
169
  type: :runtime
246
170
  prerelease: false
247
171
  version_requirements: !ruby/object:Gem::Requirement
@@ -251,7 +175,7 @@ dependencies:
251
175
  version: '4.0'
252
176
  - - "<"
253
177
  - !ruby/object:Gem::Version
254
- version: '7'
178
+ version: '7.1'
255
179
  - !ruby/object:Gem::Dependency
256
180
  name: addressable
257
181
  requirement: !ruby/object:Gem::Requirement
@@ -330,6 +254,7 @@ extra_rdoc_files: []
330
254
  files:
331
255
  - ".circleci/config.yml"
332
256
  - ".gitignore"
257
+ - ".lando.yml"
333
258
  - ".rspec"
334
259
  - ".rubocop.yml"
335
260
  - ".rubocop_todo.yml"
@@ -406,7 +331,8 @@ files:
406
331
  homepage: https://github.com/projecthydra/hydra-derivatives
407
332
  licenses:
408
333
  - APACHE2
409
- metadata: {}
334
+ metadata:
335
+ rubygems_mfa_required: 'true'
410
336
  post_install_message:
411
337
  rdoc_options: []
412
338
  require_paths:
@@ -422,7 +348,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
422
348
  - !ruby/object:Gem::Version
423
349
  version: '0'
424
350
  requirements: []
425
- rubygems_version: 3.0.3
351
+ rubygems_version: 3.1.6
426
352
  signing_key:
427
353
  specification_version: 4
428
354
  summary: Derivative generation plugin for hydra