class MultimediaParadise::ReportMissingId

Constants

ARRAY_CHECK_ON_THESE_ENTRIES
#

ARRAY_CHECK_ON_THESE_ENTRIES

Here you can specify which mp3 tags are to be checked.

#
NAMESPACE
#

NAMESPACE

#

Public Class Methods

[](i = '') click to toggle source
#

MultimediaParadise::ReportMissingId[]

#
# File lib/multimedia_paradise/audio/report_missing_id.rb, line 122
def self.[](i = '')
  new(i)
end
new( i = ARGV, run_already = true ) click to toggle source
#

initialize

#
# File lib/multimedia_paradise/audio/report_missing_id.rb, line 44
def initialize(
    i           = ARGV,
    run_already = true
  )
  reset
  set_commandline_arguments(
    i
  )
  run if run_already
end

Public Instance Methods

reset() click to toggle source
#

reset (reset tag)

#
Calls superclass method MultimediaParadise::AudioBase#reset
# File lib/multimedia_paradise/audio/report_missing_id.rb, line 58
def reset
  super()
  # ======================================================================= #
  # === @namespace
  # ======================================================================= #
  @namespace = NAMESPACE
end
run() click to toggle source
#

run (run tag)

#
# File lib/multimedia_paradise/audio/report_missing_id.rb, line 107
def run
  first = first?
  first = return_pwd if first.nil?
  _ = [first].map {|entry|
    if File.directory?(entry)
      entry = Dir[entry+'**']
    end
    entry
  }.flatten.select {|entry| is_an_audio_file?(entry) }
  work_on_these_files(_)
end
work_on_these_files(i) click to toggle source
#

work_on_these_files

This method will work on the given audio files, and identify which entry is missing.

#
# File lib/multimedia_paradise/audio/report_missing_id.rb, line 72
def work_on_these_files(i)
  problem_encountered = 0
  i.each {|this_audio_file|
    audio_tag_reader = MultimediaParadise::AudioTagReader.new(this_audio_file) { :do_not_report_anything }
    # ===================================================================== #
    # Next, we will check against the main Array.
    # ===================================================================== #
    ARRAY_CHECK_ON_THESE_ENTRIES.each {|this_entry|
      result = audio_tag_reader.send(
        (this_entry.to_s.downcase+'?').to_sym
      )
      case this_entry
      when :Artist, :artist
        if result.to_s.empty?
          problem_encountered += 1
          e problem_encountered.to_s+') No artist entry for: '+sfile(this_audio_file)
        end
      when :year
        if result.to_s == '0'
          problem_encountered += 1
          e problem_encountered.to_s+') '\
            'Faulty year entry for '+sfile(this_audio_file)+'; '\
            'the value was 0.'
          e tomato(
              '  This means that no year has been registered for this audio file.'
            )
        end
      end
    }
  }
end