class AutoTune::Util

Constants

ITUNES_TAG_KEYS

Public Class Methods

os() click to toggle source
# File lib/autotune/util.rb, line 31
def self.os
  case RUBY_PLATFORM
    when /darwin|mac os/
      return 'macos'
    else
      raise SystemCallError.new('Operating System is not supported', 1)
  end
end
parse(result_hash, track_number) click to toggle source
# File lib/autotune/util.rb, line 18
def self.parse(result_hash, track_number)
  (0..result_hash['resultCount'].to_i).each { |key|
    itunes_track_number = result_hash.dig('results', key, 'trackNumber')
    if track_number == itunes_track_number.to_i
      info = Array.new
      (0..ITUNES_TAG_KEYS.length).each { |index|
        info.push(result_hash.dig('results', key, ITUNES_TAG_KEYS[index]))
      }
      return info
    end
  }
end
paths(directory) click to toggle source
# File lib/autotune/util.rb, line 14
def self.paths(directory)
  Array.new(Find.find(directory).select { |p| /.*\.M4A$/i =~ p })
end