Sha256: 513ce0ec691643db35fe23a21241c7d245f99d124e433fe4da4f4f84903c6c8c

Contents?: true

Size: 971 Bytes

Versions: 2

Compression:

Stored size: 971 Bytes

Contents

require "carrierwave"
require "carrierwave/ffmpeg/audio/version"
require "carrierwave/ffmpeg/audio/processor"

module CarrierWave
  module Ffmpeg
    module Audio
      extend ActiveSupport::Concern

      module ClassMethods
        def convert options={}
          process convert: [ options ]
        end

        def watermark options={}
          process watermark: [ options ]
        end
      end

      def convert options={}
        cache_stored_file! if !cached?
  
        audio_filename = Processor.convert(current_path, options)
        File.rename audio_filename, current_path
        self.file.instance_variable_set(:@content_type, "audio/mpeg3")
      end
  
      def watermark options={}
        cache_stored_file! if !cached?
        
        audio_filename = Processor.watermark(current_path, options)
        File.rename audio_filename, current_path
        self.file.instance_variable_set(:@content_type, "audio/mpeg3")
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
carrierwave-ffmpeg-audio-0.1.2 lib/carrierwave/ffmpeg/audio.rb
carrierwave-ffmpeg-audio-0.1.1 lib/carrierwave/ffmpeg/audio.rb