Class: Gluttonberg::Library::Processor::Audio
- Inherits:
-
Object
- Object
- Gluttonberg::Library::Processor::Audio
- Defined in:
- lib/gluttonberg/library/processor/audio.rb
Instance Attribute Summary collapse
-
#asset ⇒ Object
Returns the value of attribute asset.
Class Method Summary collapse
-
.collect_mp3_info(asset) ⇒ Object
Collect mp3 files info using Mp3Info gem.
- .process(asset_obj) ⇒ Object
Instance Attribute Details
#asset ⇒ Object
Returns the value of attribute asset.
6 7 8 |
# File 'lib/gluttonberg/library/processor/audio.rb', line 6 def asset @asset end |
Class Method Details
.collect_mp3_info(asset) ⇒ Object
Collect mp3 files info using Mp3Info gem
15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/gluttonberg/library/processor/audio.rb', line 15 def self.collect_mp3_info(asset) begin #open mp3 file Mp3Info.open(asset.location_on_disk) do |mp3| self.update_audio_attributes(asset, mp3) end self.enqueue_job(asset) rescue => detail # if exception occurs and asset has some attributes, # then remove them. AudioAssetAttribute.where(:asset_id => asset.id).delete_all end end |
.process(asset_obj) ⇒ Object
8 9 10 11 12 |
# File 'lib/gluttonberg/library/processor/audio.rb', line 8 def self.process(asset_obj) if asset_obj.asset_type.asset_category.name == "audio" self.collect_mp3_info(asset_obj) end end |