Class: CharacterizeJob
- Inherits:
-
Object
- Object
- CharacterizeJob
- Defined in:
- lib/sufia/jobs/characterize_job.rb
Overview
Copyright © 2012 The Pennsylvania State University
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Instance Attribute Summary collapse
-
#generic_file ⇒ Object
Returns the value of attribute generic_file.
-
#generic_file_id ⇒ Object
Returns the value of attribute generic_file_id.
Instance Method Summary collapse
- #after_characterize ⇒ Object
-
#initialize(generic_file_id) ⇒ CharacterizeJob
constructor
A new instance of CharacterizeJob.
- #queue_name ⇒ Object
- #run ⇒ Object
Constructor Details
#initialize(generic_file_id) ⇒ CharacterizeJob
Returns a new instance of CharacterizeJob.
23 24 25 |
# File 'lib/sufia/jobs/characterize_job.rb', line 23 def initialize(generic_file_id) self.generic_file_id = generic_file_id end |
Instance Attribute Details
#generic_file ⇒ Object
Returns the value of attribute generic_file.
21 22 23 |
# File 'lib/sufia/jobs/characterize_job.rb', line 21 def generic_file @generic_file end |
#generic_file_id ⇒ Object
Returns the value of attribute generic_file_id.
21 22 23 |
# File 'lib/sufia/jobs/characterize_job.rb', line 21 def generic_file_id @generic_file_id end |
Instance Method Details
#after_characterize ⇒ Object
33 34 35 36 37 38 39 40 41 42 |
# File 'lib/sufia/jobs/characterize_job.rb', line 33 def after_characterize if generic_file.pdf? || generic_file.image? || generic_file.video? generic_file.create_thumbnail end if generic_file.video? Sufia.queue.push(TranscodeVideoJob.new(generic_file_id, 'content')) elsif generic_file.audio? Sufia.queue.push(TranscodeAudioJob.new(generic_file_id, 'content')) end end |
#queue_name ⇒ Object
17 18 19 |
# File 'lib/sufia/jobs/characterize_job.rb', line 17 def queue_name :characterize end |
#run ⇒ Object
27 28 29 30 31 |
# File 'lib/sufia/jobs/characterize_job.rb', line 27 def run self.generic_file = GenericFile.find(generic_file_id) generic_file.characterize after_characterize end |