Changeset 24 in flacrip
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/Ripper.pm
r23 r24 12 12 has tracks => ( 13 13 is => 'rw', 14 handles => [qw{read_disc get_tracks get_cuesheet}],14 handles => [qw{read_disc has_tracks get_cuesheet}], 15 15 ); 16 16 … … 21 21 $self->read_disc($self->device); 22 22 23 die "No tracks found; is there a CD in the drive?\n" unless @{ $self->get_tracks };23 die "No tracks found; is there a CD in the drive?\n" unless $self->has_tracks; 24 24 25 25 my $tempdir = tempdir(CLEANUP => 1); -
trunk/lib/Tracks.pm
r22 r24 1 1 package Tracks; 2 2 3 use strict; 4 use warnings; 5 6 use Class::Std; 3 use Moose; 7 4 use Digest::SHA1; 8 use Audio::FLAC::Header;9 5 10 6 use constant SECTOR_OFFSET => 150; 11 7 12 my %tracks_for :ATTR( get => 'tracks' ); 8 has tracks => ( 9 is => 'rw', 10 default => sub { [] }, 11 ); 13 12 14 13 sub _get_tracks_from_cdinfo { … … 66 65 sub read_disc { 67 66 my ($self, $device) = @_; 68 $tracks_for{ident $self} = [ _get_tracks_from_cdparanoia($device) ]; 67 $self->tracks([ _get_tracks_from_cdparanoia($device) ]); 68 } 69 70 sub has_tracks { 71 my $self = shift; 72 return @{ $self->tracks } > 0; 69 73 } 70 74 … … 72 76 my ($self) = @_; 73 77 74 my @tracks = @{ $ tracks_for{ident $self}};78 my @tracks = @{ $self->tracks }; 75 79 76 80 return unless @tracks; … … 95 99 sub get_cuesheet { 96 100 my ($self) = @_; 97 my @tracks = @{ $ tracks_for{ident $self}};101 my @tracks = @{ $self->tracks }; 98 102 my @cuesheet; 99 103 push @cuesheet, qq{FILE "cdda.wav" WAVE}; … … 112 116 my ($self) = @_; 113 117 # use a msf start unless track 1 begins at sector 114 return $ tracks_for{ident $self}[1]{sector} == 0 ? '1-' : '00:00.00-';118 return $self->tracks->[1]{sector} == 0 ? '1-' : '00:00.00-'; 115 119 } 116 120
Note: See TracChangeset
for help on using the changeset viewer.