Changeset 5 in flacrip for trunk/flactrack


Ignore:
Timestamp:
05/06/13 15:47:48 (11 years ago)
Author:
peter
Message:
  • mbz: only print non-ref values of the info
  • use-cases: added note about submitting a new discid
  • flactrack:
    • hardcoded the library location for now
    • sort the supplied %TRACKS by their keys
    • remove special characters from the output filename using quotemeta
    • abort with an error message if no MusicBrainz info is found
    • abort with an error message if the flac decoding is canceled
  • MusicBrainz.pm: select the proper medium (by DiscID) as the context for querying the tracklist, so multi-disc releases get the proper tracklist
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/flactrack

    r4 r5  
    1111use File::Path; 
    1212use Audio::FLAC::Header; 
     13#TODO: put the MusicBrainz lib in a more common location 
     14use lib qw{/home/peter/projects/flacrip}; 
    1315use MusicBrainz; 
    1416 
     
    4345if ($ALL) { 
    4446    die "Use of --all requires a --directory\n" unless $DIRECTORY; 
     47    die "No track info found on MusicBrainz for $FLAC_FILE\n" unless $info; 
    4548    use YAML; 
    4649    my $cuesheet = $flac->cuesheet; 
     
    5154        $_ => catfile($DIRECTORY, sprintf('%02d.%s', $_, to_filename($info->{TRACKS}[$_]{TITLE}))) 
    5255    } (1 .. $count); 
    53     print Dump(\%TRACKS); 
     56    #print Dump(\%TRACKS); 
     57    for my $tracknum (sort { $a <=> $b } keys %TRACKS) { 
     58        printf "%2d: %s\n", $tracknum, $TRACKS{$tracknum}; 
     59    } 
    5460    mkpath($DIRECTORY); 
    5561} 
    5662 
    57 while (my ($tracknum, $title) = each %TRACKS) { 
     63#TODO: all the option of sorting by tracknum or not 
     64#while (my ($tracknum, $title) = each %TRACKS) { 
     65for my $tracknum (sort { $a <=> $b } keys %TRACKS) { 
    5866    if ($tracknum !~ /^\d+$/) { 
    5967        warn "Don't know what to do with track number '$tracknum'"; 
     
    6876    } 
    6977 
    70     $title = quotemeta($title); 
     78    my $title = quotemeta($TRACKS{$tracknum}); 
    7179    if ($TYPE eq 'mp3') { 
    7280        # bitrate of 192 
     
    8997    #die $cmd; 
    9098    system $cmd; 
     99    die "\nFLAC decoding canceled\n" if ($? & 127); 
    91100 
    92101    print "\n" if $SOX_FILTER; 
Note: See TracChangeset for help on using the changeset viewer.