class JamTrackUploader < CarrierWave::Uploader::Base
  # include CarrierWaveDirect::Uploader
  include CarrierWave::MimeTypes

  process :set_content_type

  def initialize(*)
    super
    JamRuby::UploaderConfiguration.set_aws_private_configuration(self)
  end

  # Add a white list of extensions which are allowed to be uploaded.
  def extension_white_list
    %w(ogg)
  end

  def store_dir
    nil
  end

  def md5
    @md5 ||= ::Digest::MD5.file(current_path).hexdigest
  end

  def filename
    "#{model.preview_filename}" if model.id && model.uploading_preview
  end
end
