ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Convert-CD/lib/Convert/CD/Cue.pm
Revision: 1.3
Committed: Mon Jun 9 20:59:47 2003 UTC (23 years, 3 months ago) by root
Branch: MAIN
Changes since 1.2: +27 -3 lines
Log Message:
*** empty log message ***

File Contents

# User Rev Content
1 root 1.1 =head1 NAME
2    
3     Convert::CD::Cue - import/export .bin/.cue files.
4    
5     =head1 SYNOPSIS
6    
7     use Convert::CD::Cue;
8    
9     # to be done
10    
11     =head1 DESCRIPTION
12    
13     Parse/Write .cue files.
14    
15     =head2 Convert:CD::Cue METHODS
16    
17     This class represents a .bin/.cue file combination.
18    
19     =over 4
20    
21     =cut
22    
23     package Convert::CD::Cue;
24    
25     $VERSION = 0.01;
26    
27 root 1.3 use Carp;
28    
29 root 1.1 use base Convert::CD::TOCFile;
30    
31     =item new param => value...
32    
33     Create a new Convert::CD::Cue object.
34    
35     Parameters:
36    
37     path the base image filename
38     tocpath the (optional) path of the tocfile
39    
40     =cut
41    
42     sub new {
43     my $class = shift;
44     my $self = bless { @_, }, $class;
45 root 1.3 exists $self->{tocpath} or $self->{tocpath} = $self->find_tocfile ("cue", "CUE", "Cue");
46 root 1.1 $self;
47     }
48    
49 root 1.2 sub _read {
50     my ($self, $cd) = @_;
51    
52 root 1.3 defined $self->{tocpath}
53     or croak "no tocpath specified and/or no .cue found";
54    
55 root 1.2 open my $cue, "<", $self->{tocpath}
56 root 1.3 or croak "$self->{tocpath}: $!";
57    
58     # assumption #1: these thingies are line-based
59     while (<$cue>) {
60     s/[\015\012]+$//;
61     # assumption #2, whitespace don't matter much
62     # assumption #3, case? what case?
63     if (/\S*FILE \"?(.*?)\"? (\S+)$/) {
64     warn "DEBUG FILE: ($1) ($2)";
65     } elsif (/\S*TRACK (\d+) (\S+) ([0-9:]+)/) {
66     warn "DEBUG TRACK: ($1) ($2) ($3)\n";
67     } elsif (/\S*INDEX (\d+) ([0-9:]+)/) {
68     warn "DEBUG INDEX ($1) ($2)\n";
69     } elsif (/\S*PREGAP ([0-9:]+)/) {
70     warn "DEBUG PREGAP ($1)\n";
71     } elsif (/\S*POSTGAP ([0-9:]+)/) {
72     warn "DEBUG POSTGAP ($1)\n";
73     } else {
74     warn "unknown .cue directive skipped: $_";
75     }
76     }
77 root 1.2 }
78 root 1.1
79     #sub _write {
80     # my ($self, $cd) = @_;
81     #}
82    
83     1;
84    
85     =back
86    
87     =head1 AUTHOR
88    
89     Marc Lehmann <pcg@goof.com>
90    
91     =cut
92