From: Colin Patrick McCabe Date: Sat, 3 Apr 2010 20:36:45 +0000 (-0700) Subject: superrip: fix manifest validation X-Git-Url: http://club.cc.cmu.edu/~cmccabe/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7fe95fb9f1fe0ec22d3a1d0f683b75fc8edc8c5e;p=cmccabe-bin superrip: fix manifest validation Fix manifest validation. Also, fix parsing of cdda2wav output for discs with fewer than 10 tracks. --- diff --git a/superrip.rb b/superrip.rb index bdf7512..d9ab7d7 100755 --- a/superrip.rb +++ b/superrip.rb @@ -44,8 +44,8 @@ def get_number_of_tracks_on_cd look_for_tracks = true elsif (look_for_tracks == true) then look_for_tracks = false - line =~ /[ \t]*1-([1234567890][1234567890]*)[^1234567890]/ \ - or raise "couldn't understand cdda2wav output!" + line =~ /[ \t]*1-([ 1234567890][1234567890]*)[^1234567890]/ \ + or raise "couldn't understand cdda2wav output! (line:#{line})" return $1.to_i end end @@ -184,11 +184,10 @@ class Manifest if (@t.empty?) then raise "you must define some tracks" end - @t.each { |t| t.validate } if (not $opts.partial) then - (1..num_tracks).each do |t| - if not @t[t].defined? - raise "don't know what to do with track #{t}" + (1..num_tracks).each do |tnum| + if not @t.has_key?(tnum) + raise "don't know what to do with track #{tnum}" end end end @@ -235,6 +234,7 @@ manifest = Manifest.new($opts.manifest_file) puts manifest.inspect num_tracks = get_number_of_tracks_on_cd() puts "found #{num_tracks} tracks" +manifest.validate(num_tracks) manifest.rip(num_tracks) puts "*** FINISHED ***" exit 0