Module: Hydra::Derivatives
- Extended by:
- ActiveSupport::Autoload, ActiveSupport::Concern, Deprecation
- Defined in:
- lib/hydra/derivatives.rb,
lib/hydra/derivatives/audio.rb,
lib/hydra/derivatives/image.rb,
lib/hydra/derivatives/video.rb,
lib/hydra/derivatives/config.rb,
lib/hydra/derivatives/ffmpeg.rb,
lib/hydra/derivatives/logger.rb,
lib/hydra/derivatives/document.rb,
lib/hydra/derivatives/processor.rb,
lib/hydra/derivatives/raw_image.rb,
lib/hydra/derivatives/io_decorator.rb,
lib/hydra/derivatives/jpeg2k_image.rb,
lib/hydra/derivatives/video/processor.rb,
lib/hydra/derivatives/extract_metadata.rb,
lib/hydra/derivatives/shell_based_processor.rb,
lib/hydra/derivatives/services/tempfile_service.rb,
lib/hydra/derivatives/services/persist_output_file_service.rb,
lib/hydra/derivatives/services/retrieve_source_file_service.rb,
lib/hydra/derivatives/services/persist_basic_contained_output_file_service.rb
Defined Under Namespace
Modules: ClassMethods, ExtractMetadata, Ffmpeg, ShellBasedProcessor, Video
Classes: Audio, Config, Document, Image, IoDecorator, Jpeg2kImage, Logger, PersistBasicContainedOutputFileService, PersistOutputFileService, Processor, RawImage, RetrieveSourceFileService, TempfileService, TimeoutError
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.config ⇒ Object
36
37
38
|
# File 'lib/hydra/derivatives.rb', line 36
def self.config
@config ||= reset_config!
end
|
.reset_config! ⇒ Object
40
41
42
|
# File 'lib/hydra/derivatives.rb', line 40
def self.reset_config!
@config = Config.new
end
|
Instance Method Details
#constantize_processor(processor) ⇒ Object
116
117
118
119
120
|
# File 'lib/hydra/derivatives.rb', line 116
def constantize_processor(processor)
"Hydra::Derivatives::#{processor.classify}".constantize
rescue NameError
processor.classify.constantize
end
|
#create_derivatives ⇒ Object
Runs all of the transformations immediately. You may want to run this job in the background as it may take a long time.
62
63
64
65
66
67
68
69
70
71
72
73
74
|
# File 'lib/hydra/derivatives.rb', line 62
def create_derivatives
if transformation_schemes.present?
transformation_schemes.each do |transform_scheme|
if transform_scheme.instance_of?(Proc)
transform_scheme.call(self)
else
send(transform_scheme)
end
end
else
logger.warn "`create_derivatives' was called on an instance of #{self.class}, but no derivatives have been requested"
end
end
|
#processor_class(processor) ⇒ Object
107
108
109
110
111
112
113
114
|
# File 'lib/hydra/derivatives.rb', line 107
def processor_class(processor)
case processor
when :video
Hydra::Derivatives::Video::Processor
else
constantize_processor(processor.to_s)
end
end
|
122
123
124
|
# File 'lib/hydra/derivatives.rb', line 122
def transform_datastream(file_name, transform_directives, opts={})
transform_file(file_name, transform_directives, opts={})
end
|
Create derivatives from a file according to transformation directives
103
104
105
|
# File 'lib/hydra/derivatives.rb', line 103
def transform_file(file_name, transform_directives, opts={})
initialize_processor(file_name, transform_directives, opts).process
end
|