# HG changeset patch # User darius # Date 1026974032 0 # Node ID 2c01c09bdc0f25f0303acf4f6bc3e12da60259a6 # Parent ad83a38c3f5ac7db63766df1c5297ea9ebcf6fff Handle "artist - title" as well as "artist / title". Add track number to filename. If the infile isn't stdin, move it to the mp3 directory. diff -r ad83a38c3f5a -r 2c01c09bdc0f cddb2.tcl --- a/cddb2.tcl Thu Jul 18 06:29:35 2002 +0000 +++ b/cddb2.tcl Thu Jul 18 06:33:52 2002 +0000 @@ -112,11 +112,13 @@ } "DTITLE" { - if {[regexp {^(.*) / (.*)$} $value a tracks(albumartist) tracks(albumname)] != 1} { - set tracks(albumname) $value; - } else { - puts "Atrist - $tracks(albumartist)"; + puts "Searching title - $value"; + if {![regexp {^(.*) / (.*)$} $value a tracks(albumartist) tracks(albumname)]} { + if {![regexp {^(.*) - (.*)$} $value a tracks(albumartist) tracks(albumname)]} { + set tracks(albumname) $value; + } } + puts "Artist - $tracks(albumartist)"; puts "Title - $tracks(albumname)"; } @@ -183,7 +185,7 @@ continue; } - set t_artist($i) "Unknown"; + set tracks(artist:$i) ""; } # puts "$tracks(number) tracks"; @@ -249,12 +251,15 @@ quoter tracks(title:$t_no); set oldname [ eval format {$oldbasename} {$t_no} ]; - set newname [ eval format {$newbasename} {"$tracks(artist:$t_no) - $tracks(title:$t_no)"} ]; + set newname [ eval format {$newbasename} {"[format %02d $t_no] $tracks(artist:$t_no) - $tracks(title:$t_no)"} ]; puts $out "mp3info -a \"$tracks(artist:$t_no)\" -t \"$tracks(title:$t_no)\" -l \"$tracks(albumname)\" -c \"Track $t_no\" -F 4 \"$oldname\""; puts $out "mv \"$oldname\" \"$dirname/$newname\""; } + if {$infile != "-"} { + puts $out "mv \"$infile\" \"$dirname\""; + } if {[catch {close $out} msg]} { puts "Got $msg closing renamer"; }