- Timestamp:
- 05/08/15 20:00:01 (10 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/cd2flac
r38 r41 37 37 $CD_DEVICE ||= '/dev/cdrom'; 38 38 39 my $tags = $BARCODE ? { BARCODE => $BARCODE } : {}; 39 40 my $ripper = Ripper->new({ device => $CD_DEVICE }); 40 $ripper->rip_to_flac($archive_flac); 41 42 if ($BARCODE) { 43 print "Writing barcode\n"; 44 system 'metaflac', '--set-tag', "BARCODE=$BARCODE", $archive_flac; 45 } 41 $ripper->rip_to_flac($archive_flac, $tags); 46 42 47 43 print "Rip saved as $archive_flac\n"; -
trunk/lib/Ripper.pm
r29 r41 4 4 5 5 use Tracks; 6 use DiscFlacFile; 6 7 7 8 use File::Temp qw{tempdir}; … … 20 21 21 22 sub rip_to_flac { 22 my ($self, $archive_flac ) = @_;23 my ($self, $archive_flac, $tags) = @_; 23 24 24 25 $self->tracks(Tracks->new); … … 50 51 # copy to permanent location 51 52 copy($flac_file, $archive_flac); 52 system 'metaflac', '--set-tag', "MUSICBRAINZ_DISCID=$discid", $archive_flac; 53 54 # tag the archive flac 55 $tags ||= {}; 56 $tags->{MUSICBRAINZ_DISCID} = $discid; 57 my $flac_disc = DiscFlacFile->new({ file => $archive_flac }); 58 $flac_disc->flac->{tags}{$_} = $tags->{$_} foreach keys %{$tags}; 59 $flac_disc->flac->write; 60 61 return $flac_disc; 53 62 } 54 63
Note: See TracChangeset
for help on using the changeset viewer.