class Object

Constants

LIB_DIR

Public Class Methods

new() click to toggle source
# File oldcode/rubysong.rb, line 65
def initialize
  @songs = Array.new
end

Public Instance Methods

fix_mins(secs) click to toggle source
# File oldcode/cddb.rb, line 199
def fix_mins(secs)
    puts "SECS: (#{secs})"
    secs = secs.to_i
    puts "SECS: (#{secs})"
    if secs >= 60
        mins = (secs / 60).to_i
        secs = secs % 60
    else
        mins = 0
    end
    #puts "TIME: (#{time})"
    sprintf "%d:%02d", mins, secs
end
fix_offsets(disk_secs,offsets) click to toggle source
# File oldcode/cddb.rb, line 174
def fix_offsets(disk_secs,offsets)
    puts "Got disk_secs: (#{disk_secs})"
    offsets << disk_secs.to_i * @@FrameConversion
    #disk_frames = disk_secs * @@FrameConversion
    length = offsets.length
    puts "Offset length: #{length}"
    puts "Elements: (" << offsets.join(", ") << ")"
    times = []
    #working_offsets = offsets << disk_frames
    #[offsets,disk_frames].each_with_index do |val,idx|
    offsets.each_with_index do |val,idx|
        puts "IDX"
        break if idx == offsets.length - 1
        len = (offsets[idx+1].to_i - offsets[idx].to_i) / @@FrameConversion
        time = self.fix_mins(len)
        times << time
    end
    #puts "TIMES: (" << times.join(", ") << ") (#{times.length})"
    puts "TIMES: (" << times.join(", ") << ") (#{times.length})"
    times
end
go!() click to toggle source
# File bin/cddb_parser, line 9
def go!
  options = CddbParser::GetOpts.parse(ARGV)
  pp options
  cddb = CddbParser::ParseCddbFile.new(options.files)
  if options.check
    cddb.check_files
  elsif options.list
    puts "loption: #{options.list}"
    cddb.list_files(options.list)
  elsif options.store
    cddb.store_files(options.store, options.user, options.password)
  end
end