if(File::exists?("../ext/rb_cdio.so")) require "../ext/rb_cdio" else require 'rubygems' require_gem "rb_cdio",">=0.2" end dev=( ARGV[0].nil? ) ? nil:ARGV[0]; CdIo.open(ARGV[0]) {|cd| puts "Device:"+cd.device puts "Mcn:"+cd.mcn.to_s puts "Driver Id:"+cd.driver_id.to_s puts "Driver Name:"+cd.driver_name.to_s puts "First Track Num:"+cd.first_track_num.to_s puts "Track number:"+cd.num_tracks.to_s puts "Discmode: "+CdIo.discmode_describe(cd.discmode); puts "Is Cd?: "+((cd.is_cd? ) ? "Yes" : "No"); puts "Is Dvd?: "+((cd.is_dvd? ) ? "Yes" : "No"); cdda=false if (cd.discmode==CdIo::CDIO_DISC_MODE_CD_DA) puts "CDTEXT: "+cd.cdtext.to_s puts "Cddb: "+cd.cddb_id begin cd.cddb_fetch(1) puts "Artist:"+cd.artist puts "Title:"+cd.title cdda=true rescue =>e puts "ERROR - Can't get cddb info : "+e.to_s end end cd.tracks.each {|track| puts "=========\nTrack number "+track.number.to_s puts CdIo.track_format_describe(track.format); if(cd.discmode==CdIo::CDIO_DISC_MODE_CD_DA) puts "CDTEXT:"+track.cdtext.to_s end puts "Format: "+CdIo.track_format_describe(track.format); puts "Type: "+CdIo.track_type_describe(track); puts "Mfs: "+track.msf if(cdda) puts "Title:"+track.title end } }