hydra-derivatives 3.6.1 → 3.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +60 -9
- data/.lando.yml +27 -0
- data/.rubocop.yml +3 -2
- data/CONTRIBUTING.md +8 -8
- data/Gemfile +1 -3
- data/README.md +6 -8
- data/Rakefile +0 -2
- data/VERSION +1 -1
- data/hydra-derivatives.gemspec +8 -9
- data/lib/hydra/derivatives/audio_encoder.rb +1 -0
- data/lib/hydra/derivatives/config.rb +1 -0
- data/lib/hydra/derivatives/io_decorator.rb +2 -1
- data/lib/hydra/derivatives/logger.rb +4 -3
- data/lib/hydra/derivatives/processors/active_encode.rb +1 -0
- data/lib/hydra/derivatives/processors/audio.rb +1 -0
- data/lib/hydra/derivatives/processors/ffmpeg.rb +1 -0
- data/lib/hydra/derivatives/processors/image.rb +2 -1
- data/lib/hydra/derivatives/processors/jpeg2k_image.rb +3 -3
- data/lib/hydra/derivatives/processors/processor.rb +1 -0
- data/lib/hydra/derivatives/processors/raw_image.rb +1 -0
- data/lib/hydra/derivatives/processors/shell_based_processor.rb +10 -3
- data/lib/hydra/derivatives/processors/video/config.rb +5 -4
- data/lib/hydra/derivatives/processors/video/processor.rb +21 -3
- data/lib/hydra/derivatives/processors/video.rb +1 -0
- data/lib/hydra/derivatives/processors.rb +1 -0
- data/lib/hydra/derivatives/runners/active_encode_derivatives.rb +1 -0
- data/lib/hydra/derivatives/runners/audio_derivatives.rb +1 -0
- data/lib/hydra/derivatives/runners/document_derivatives.rb +1 -0
- data/lib/hydra/derivatives/runners/full_text_extract.rb +1 -0
- data/lib/hydra/derivatives/runners/image_derivatives.rb +1 -0
- data/lib/hydra/derivatives/runners/jpeg2k_image_derivatives.rb +1 -0
- data/lib/hydra/derivatives/runners/pdf_derivatives.rb +1 -0
- data/lib/hydra/derivatives/runners/runner.rb +1 -0
- data/lib/hydra/derivatives/runners/video_derivatives.rb +1 -0
- data/lib/hydra/derivatives/services/capability_service.rb +1 -0
- data/lib/hydra/derivatives/services/mime_type_service.rb +1 -0
- data/lib/hydra/derivatives/services/persist_basic_contained_output_file_service.rb +1 -0
- data/lib/hydra/derivatives/services/persist_external_file_output_file_service.rb +1 -0
- data/lib/hydra/derivatives/services/persist_output_file_service.rb +1 -0
- data/lib/hydra/derivatives/services/remote_source_file.rb +1 -0
- data/lib/hydra/derivatives/services/retrieve_source_file_service.rb +1 -0
- data/lib/hydra/derivatives/services/tempfile_service.rb +1 -0
- data/lib/hydra/derivatives.rb +1 -0
- metadata +35 -123
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2b9642a74101fb1b816e9b1a6e994065991930c6d3fe51a48f698275b11291c8
|
4
|
+
data.tar.gz: 3b4f2505d50372b3d52318deefaab4586028e48d3f6820c9179c1c747a7e4c2b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e9cdbf207aca051db6a3d281e7e019df5be05f4fa0b5f6e1c65b64cb6e3388c8838d9cd13991e7b1f740b1c79dbbd65b782dea3d7e5661a5bcdcd07c40bd540b
|
7
|
+
data.tar.gz: d96492b3804b2f19effc7aa5c0de247080324c036efea58e34c7db7e1888ff14af9010654da8afd0ffbf9b62262359f208cb1458faef18785f40f9fbc9d25758
|
data/.circleci/config.yml
CHANGED
@@ -8,26 +8,51 @@ jobs:
|
|
8
8
|
type: string
|
9
9
|
bundler_version:
|
10
10
|
type: string
|
11
|
-
default: 2.
|
11
|
+
default: 2.3.10
|
12
12
|
executor:
|
13
13
|
name: 'samvera/ruby_fcrepo_solr'
|
14
14
|
ruby_version: << parameters.ruby_version >>
|
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: |
|
21
30
|
sudo apt-get update
|
22
31
|
sudo apt-get install ghostscript libpng-dev imagemagick ffmpeg libreoffice dcraw
|
23
|
-
-
|
32
|
+
- restore_cache:
|
33
|
+
name: Restore Kakadu Cache
|
34
|
+
keys:
|
35
|
+
- kakadu-cache-v1
|
36
|
+
- run:
|
37
|
+
name: Download Kakadu
|
38
|
+
command: |
|
39
|
+
if [ ! -f ~/downloads/kakadu.zip ]; then
|
40
|
+
mkdir -p ~/downloads
|
41
|
+
wget http://kakadusoftware.com/wp-content/uploads/KDU805_Demo_Apps_for_Linux-x86-64_200602.zip -O ~/downloads/kakadu.zip
|
42
|
+
fi
|
43
|
+
- save_cache:
|
44
|
+
name: Save Kakadu Cache
|
45
|
+
key: kakadu-cache-v1
|
46
|
+
paths:
|
47
|
+
- ~/downloads/kakadu.zip
|
24
48
|
- run:
|
25
49
|
name: Install Kakadu
|
26
50
|
command: |
|
27
|
-
|
28
|
-
|
51
|
+
unzip ~/downloads/kakadu.zip
|
52
|
+
mv KDU805_Demo_Apps_for_Linux-x86-64_200602 kakadu
|
29
53
|
sudo cp kakadu/*.so /usr/lib
|
30
54
|
sudo cp kakadu/* /usr/bin
|
55
|
+
kdu_compress -version
|
31
56
|
- run:
|
32
57
|
name: Modify ImageMagick security policy
|
33
58
|
command: sudo sed -i 's/policy domain="coder" rights="none" pattern="PDF"/policy domain="coder" rights="read|write" pattern="PDF"/' /etc/ImageMagick-6/policy.xml
|
@@ -38,6 +63,7 @@ jobs:
|
|
38
63
|
- samvera/bundle:
|
39
64
|
ruby_version: << parameters.ruby_version >>
|
40
65
|
bundler_version: << parameters.bundler_version >>
|
66
|
+
cache_version: "2"
|
41
67
|
|
42
68
|
- samvera/install_solr_core
|
43
69
|
|
@@ -49,11 +75,36 @@ workflows:
|
|
49
75
|
ci:
|
50
76
|
jobs:
|
51
77
|
- bundle_lint_test:
|
52
|
-
name:
|
53
|
-
ruby_version: 2.
|
78
|
+
name: ruby3-2
|
79
|
+
ruby_version: 3.2.0
|
80
|
+
- bundle_lint_test:
|
81
|
+
name: ruby3-1
|
82
|
+
ruby_version: 3.1.3
|
83
|
+
- bundle_lint_test:
|
84
|
+
name: ruby3-0
|
85
|
+
ruby_version: 3.0.3
|
86
|
+
- bundle_lint_test:
|
87
|
+
name: ruby2-7
|
88
|
+
ruby_version: 2.7.7
|
89
|
+
|
90
|
+
nightly:
|
91
|
+
triggers:
|
92
|
+
- schedule:
|
93
|
+
cron: "0 0 * * *"
|
94
|
+
filters:
|
95
|
+
branches:
|
96
|
+
only:
|
97
|
+
- main
|
98
|
+
jobs:
|
99
|
+
- bundle_lint_test:
|
100
|
+
name: ruby3-2
|
101
|
+
ruby_version: 3.2.0
|
102
|
+
- bundle_lint_test:
|
103
|
+
name: ruby3-1
|
104
|
+
ruby_version: 3.1.3
|
54
105
|
- bundle_lint_test:
|
55
|
-
name:
|
56
|
-
ruby_version:
|
106
|
+
name: ruby3-0
|
107
|
+
ruby_version: 3.0.3
|
57
108
|
- bundle_lint_test:
|
58
109
|
name: ruby2-7
|
59
|
-
ruby_version: 2.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
|
-
|
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:
|
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
|
49
|
-
* To quickly create a topic branch based on
|
50
|
-
* Then checkout the new branch with `git checkout fix/
|
51
|
-
* Please avoid working directly on the `
|
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.
|
113
|
-
* `git checkout
|
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
|
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
|
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
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=
|
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
|
-
|
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
|
-
|
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
|
-
[
|
24
|
+
[stkenny](https://github.com/stkenny)
|
27
25
|
|
28
26
|
# Help
|
29
27
|
|
@@ -225,7 +223,7 @@ Instead, each directive may contain these arguments:
|
|
225
223
|
* [ImageMagick](https://www.imagemagick.org)
|
226
224
|
* On a mac, do `brew install imagemagick`
|
227
225
|
* [LibreOffice](https://www.libreoffice.org/)
|
228
|
-
* * On a mac, do `brew
|
226
|
+
* * On a mac, do `brew install libreoffice --cask`
|
229
227
|
* [Kakadu](http://kakadusoftware.com/)
|
230
228
|
* On a mac, extract the file and run the pkg installer therein (don't get distracted by the files called kdu_show)
|
231
229
|
* [Ghostscript](https://www.ghostscript.com/)
|
@@ -260,4 +258,4 @@ If you don't want to run the whole suite all at once like CI, do the following:
|
|
260
258
|
This software has been developed by and is brought to you by the Samvera community. Learn more at the
|
261
259
|
[Samvera website](http://samvera.org/).
|
262
260
|
|
263
|
-
![Samvera Logo](https://
|
261
|
+
![Samvera Logo](https://samvera.org/wp-content/uploads/2017/06/samvera-logo-tm.svg)
|
data/Rakefile
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.
|
1
|
+
3.8.0
|
data/hydra-derivatives.gemspec
CHANGED
@@ -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,17 +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.
|
21
|
-
spec.add_development_dependency 'rake'
|
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"
|
24
|
+
spec.add_development_dependency "solr_wrapper"
|
24
25
|
|
25
|
-
spec.add_dependency '
|
26
|
-
|
27
|
-
|
28
|
-
spec.add_dependency '
|
29
|
-
spec.add_dependency 'activemodel', '< 6.1'
|
30
|
-
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'
|
31
30
|
spec.add_dependency 'addressable', '~> 2.5'
|
32
31
|
spec.add_dependency 'deprecation'
|
33
32
|
spec.add_dependency 'mime-types', '> 2.0', '< 4.0'
|
@@ -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
|
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
|
-
|
21
|
-
|
22
|
-
|
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 '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
|
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
|
# 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
|
-
|
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
|
-
|
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: #{
|
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 #{
|
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
|
-
|
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
|
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
|
data/lib/hydra/derivatives.rb
CHANGED
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.
|
4
|
+
version: 3.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Coyne
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
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.
|
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.
|
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: '
|
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: '
|
88
|
+
version: '0'
|
89
89
|
- !ruby/object:Gem::Dependency
|
90
90
|
name: rspec
|
91
91
|
requirement: !ruby/object:Gem::Requirement
|
@@ -104,148 +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: '
|
109
|
+
version: '0'
|
110
110
|
type: :development
|
111
111
|
prerelease: false
|
112
112
|
version_requirements: !ruby/object:Gem::Requirement
|
113
113
|
requirements:
|
114
|
-
- - "
|
114
|
+
- - ">="
|
115
115
|
- !ruby/object:Gem::Version
|
116
|
-
version: '
|
116
|
+
version: '0'
|
117
117
|
- !ruby/object:Gem::Dependency
|
118
|
-
name:
|
118
|
+
name: active_encode
|
119
119
|
requirement: !ruby/object:Gem::Requirement
|
120
120
|
requirements:
|
121
|
-
- - "
|
122
|
-
- !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
|
-
- - "!="
|
121
|
+
- - "~>"
|
167
122
|
- !ruby/object:Gem::Version
|
168
|
-
version:
|
123
|
+
version: '0.1'
|
169
124
|
type: :runtime
|
170
125
|
prerelease: false
|
171
126
|
version_requirements: !ruby/object:Gem::Requirement
|
172
127
|
requirements:
|
173
|
-
- - "
|
174
|
-
- !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
|
-
- - "!="
|
128
|
+
- - "~>"
|
219
129
|
- !ruby/object:Gem::Version
|
220
|
-
version:
|
130
|
+
version: '0.1'
|
221
131
|
- !ruby/object:Gem::Dependency
|
222
|
-
name:
|
132
|
+
name: active-fedora
|
223
133
|
requirement: !ruby/object:Gem::Requirement
|
224
134
|
requirements:
|
225
|
-
- - "
|
135
|
+
- - ">="
|
226
136
|
- !ruby/object:Gem::Version
|
227
|
-
version: '0
|
137
|
+
version: '14.0'
|
228
138
|
type: :runtime
|
229
139
|
prerelease: false
|
230
140
|
version_requirements: !ruby/object:Gem::Requirement
|
231
141
|
requirements:
|
232
|
-
- - "
|
142
|
+
- - ">="
|
233
143
|
- !ruby/object:Gem::Version
|
234
|
-
version: '0
|
144
|
+
version: '14.0'
|
235
145
|
- !ruby/object:Gem::Dependency
|
236
|
-
name:
|
146
|
+
name: active-triples
|
237
147
|
requirement: !ruby/object:Gem::Requirement
|
238
148
|
requirements:
|
239
|
-
- - "
|
149
|
+
- - ">="
|
240
150
|
- !ruby/object:Gem::Version
|
241
|
-
version: '
|
151
|
+
version: '1.2'
|
242
152
|
type: :runtime
|
243
153
|
prerelease: false
|
244
154
|
version_requirements: !ruby/object:Gem::Requirement
|
245
155
|
requirements:
|
246
|
-
- - "
|
156
|
+
- - ">="
|
247
157
|
- !ruby/object:Gem::Version
|
248
|
-
version: '
|
158
|
+
version: '1.2'
|
249
159
|
- !ruby/object:Gem::Dependency
|
250
160
|
name: activesupport
|
251
161
|
requirement: !ruby/object:Gem::Requirement
|
@@ -255,7 +165,7 @@ dependencies:
|
|
255
165
|
version: '4.0'
|
256
166
|
- - "<"
|
257
167
|
- !ruby/object:Gem::Version
|
258
|
-
version: '7'
|
168
|
+
version: '7.1'
|
259
169
|
type: :runtime
|
260
170
|
prerelease: false
|
261
171
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -265,7 +175,7 @@ dependencies:
|
|
265
175
|
version: '4.0'
|
266
176
|
- - "<"
|
267
177
|
- !ruby/object:Gem::Version
|
268
|
-
version: '7'
|
178
|
+
version: '7.1'
|
269
179
|
- !ruby/object:Gem::Dependency
|
270
180
|
name: addressable
|
271
181
|
requirement: !ruby/object:Gem::Requirement
|
@@ -344,6 +254,7 @@ extra_rdoc_files: []
|
|
344
254
|
files:
|
345
255
|
- ".circleci/config.yml"
|
346
256
|
- ".gitignore"
|
257
|
+
- ".lando.yml"
|
347
258
|
- ".rspec"
|
348
259
|
- ".rubocop.yml"
|
349
260
|
- ".rubocop_todo.yml"
|
@@ -420,8 +331,9 @@ files:
|
|
420
331
|
homepage: https://github.com/projecthydra/hydra-derivatives
|
421
332
|
licenses:
|
422
333
|
- APACHE2
|
423
|
-
metadata:
|
424
|
-
|
334
|
+
metadata:
|
335
|
+
rubygems_mfa_required: 'true'
|
336
|
+
post_install_message:
|
425
337
|
rdoc_options: []
|
426
338
|
require_paths:
|
427
339
|
- lib
|
@@ -437,7 +349,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
437
349
|
version: '0'
|
438
350
|
requirements: []
|
439
351
|
rubygems_version: 3.1.6
|
440
|
-
signing_key:
|
352
|
+
signing_key:
|
441
353
|
specification_version: 4
|
442
354
|
summary: Derivative generation plugin for hydra
|
443
355
|
test_files: []
|