annotate read_c2w.tcl @ 7:ad83a38c3f5a

Don't open RW - not necessary.
author darius
date Thu, 18 Jul 2002 06:29:35 +0000
parents dd6e30f7eb42
children c122160e07da
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
dd6e30f7eb42 Initial revision
darius
parents:
diff changeset
1 #!/usr/local/bin/tclsh8.0
dd6e30f7eb42 Initial revision
darius
parents:
diff changeset
2 #
dd6e30f7eb42 Initial revision
darius
parents:
diff changeset
3 # This software is copyright Daniel O'Connor (darius@dons.net.au) 1998
dd6e30f7eb42 Initial revision
darius
parents:
diff changeset
4 #
dd6e30f7eb42 Initial revision
darius
parents:
diff changeset
5 # This software is release under the GNU Public License Version 2.
dd6e30f7eb42 Initial revision
darius
parents:
diff changeset
6 # A copy of this licence must be distributed with this software.
dd6e30f7eb42 Initial revision
darius
parents:
diff changeset
7 #
dd6e30f7eb42 Initial revision
darius
parents:
diff changeset
8
dd6e30f7eb42 Initial revision
darius
parents:
diff changeset
9 set offset_seek 0;
dd6e30f7eb42 Initial revision
darius
parents:
diff changeset
10 set offset_list "";
dd6e30f7eb42 Initial revision
darius
parents:
diff changeset
11
dd6e30f7eb42 Initial revision
darius
parents:
diff changeset
12 while { 1 } {
dd6e30f7eb42 Initial revision
darius
parents:
diff changeset
13 if { [ eof stdin ] } {
dd6e30f7eb42 Initial revision
darius
parents:
diff changeset
14 break;
dd6e30f7eb42 Initial revision
darius
parents:
diff changeset
15 }
dd6e30f7eb42 Initial revision
darius
parents:
diff changeset
16
dd6e30f7eb42 Initial revision
darius
parents:
diff changeset
17 set line [ gets stdin ];
dd6e30f7eb42 Initial revision
darius
parents:
diff changeset
18
dd6e30f7eb42 Initial revision
darius
parents:
diff changeset
19 if { $offset_seek > 0 } {
dd6e30f7eb42 Initial revision
darius
parents:
diff changeset
20 if { $line == "\#" } {
dd6e30f7eb42 Initial revision
darius
parents:
diff changeset
21 continue;
dd6e30f7eb42 Initial revision
darius
parents:
diff changeset
22 }
dd6e30f7eb42 Initial revision
darius
parents:
diff changeset
23
dd6e30f7eb42 Initial revision
darius
parents:
diff changeset
24 if { [ regexp {^\# ([0-9]+)} $line a offset ] == 1 } {
dd6e30f7eb42 Initial revision
darius
parents:
diff changeset
25 lappend offset_list $offset;
dd6e30f7eb42 Initial revision
darius
parents:
diff changeset
26 continue;
dd6e30f7eb42 Initial revision
darius
parents:
diff changeset
27 }
dd6e30f7eb42 Initial revision
darius
parents:
diff changeset
28
dd6e30f7eb42 Initial revision
darius
parents:
diff changeset
29 # Change back to default state
dd6e30f7eb42 Initial revision
darius
parents:
diff changeset
30 set offset_seek 0;
dd6e30f7eb42 Initial revision
darius
parents:
diff changeset
31 }
dd6e30f7eb42 Initial revision
darius
parents:
diff changeset
32
dd6e30f7eb42 Initial revision
darius
parents:
diff changeset
33 if { [ regexp {^\# Track frame offsets:} $line ] == 1 } {
dd6e30f7eb42 Initial revision
darius
parents:
diff changeset
34 # Change to looking for offsets state
dd6e30f7eb42 Initial revision
darius
parents:
diff changeset
35 set offset_seek 1;
dd6e30f7eb42 Initial revision
darius
parents:
diff changeset
36 }
dd6e30f7eb42 Initial revision
darius
parents:
diff changeset
37
dd6e30f7eb42 Initial revision
darius
parents:
diff changeset
38 if { [ regexp {^\# Disc length: ([0-9]+)} $line a disclen ] == 1 } {
dd6e30f7eb42 Initial revision
darius
parents:
diff changeset
39 continue;
dd6e30f7eb42 Initial revision
darius
parents:
diff changeset
40 }
dd6e30f7eb42 Initial revision
darius
parents:
diff changeset
41
dd6e30f7eb42 Initial revision
darius
parents:
diff changeset
42 if { [ regexp {^DISCID=(\ ?)([0-9a-f]+)} $line a spc discid ] == 1 } {
dd6e30f7eb42 Initial revision
darius
parents:
diff changeset
43 if { $spc == " " } {
dd6e30f7eb42 Initial revision
darius
parents:
diff changeset
44 set discid "0$discid";
dd6e30f7eb42 Initial revision
darius
parents:
diff changeset
45 }
dd6e30f7eb42 Initial revision
darius
parents:
diff changeset
46 continue;
dd6e30f7eb42 Initial revision
darius
parents:
diff changeset
47 }
dd6e30f7eb42 Initial revision
darius
parents:
diff changeset
48
dd6e30f7eb42 Initial revision
darius
parents:
diff changeset
49 }
dd6e30f7eb42 Initial revision
darius
parents:
diff changeset
50
dd6e30f7eb42 Initial revision
darius
parents:
diff changeset
51 if { ![ info exists discid ] || ![ info exists offset_list ] || ![ info exists disclen ] } {
dd6e30f7eb42 Initial revision
darius
parents:
diff changeset
52 puts "Didn't get all information needed";
dd6e30f7eb42 Initial revision
darius
parents:
diff changeset
53 exit 1;
dd6e30f7eb42 Initial revision
darius
parents:
diff changeset
54 }
dd6e30f7eb42 Initial revision
darius
parents:
diff changeset
55
dd6e30f7eb42 Initial revision
darius
parents:
diff changeset
56 puts "$discid $offset_list $disclen"
dd6e30f7eb42 Initial revision
darius
parents:
diff changeset
57 #puts "Disc ID: $discid";
dd6e30f7eb42 Initial revision
darius
parents:
diff changeset
58 #puts "Disc Length: $disclen seconds";
dd6e30f7eb42 Initial revision
darius
parents:
diff changeset
59 #puts "Track offsets: $offset_list";
dd6e30f7eb42 Initial revision
darius
parents:
diff changeset
60
dd6e30f7eb42 Initial revision
darius
parents:
diff changeset
61 # # xmcd
dd6e30f7eb42 Initial revision
darius
parents:
diff changeset
62 # #
dd6e30f7eb42 Initial revision
darius
parents:
diff changeset
63 # # Track frame offsets:
dd6e30f7eb42 Initial revision
darius
parents:
diff changeset
64 # #
dd6e30f7eb42 Initial revision
darius
parents:
diff changeset
65 # # 150
dd6e30f7eb42 Initial revision
darius
parents:
diff changeset
66 # # 147307
dd6e30f7eb42 Initial revision
darius
parents:
diff changeset
67 # #
dd6e30f7eb42 Initial revision
darius
parents:
diff changeset
68 # # Disc length: 3860 seconds
dd6e30f7eb42 Initial revision
darius
parents:
diff changeset
69 # #
dd6e30f7eb42 Initial revision
darius
parents:
diff changeset
70 # # Revision: 0
dd6e30f7eb42 Initial revision
darius
parents:
diff changeset
71 # # Submitted via: cdda2wav 0.95beta05
dd6e30f7eb42 Initial revision
darius
parents:
diff changeset
72 # DISCID=160f1402
dd6e30f7eb42 Initial revision
darius
parents:
diff changeset
73 # DTITLE=
dd6e30f7eb42 Initial revision
darius
parents:
diff changeset
74 # TTITLE0=
dd6e30f7eb42 Initial revision
darius
parents:
diff changeset
75 # TTITLE1=
dd6e30f7eb42 Initial revision
darius
parents:
diff changeset
76 # EXTD=
dd6e30f7eb42 Initial revision
darius
parents:
diff changeset
77 # EXTT0=
dd6e30f7eb42 Initial revision
darius
parents:
diff changeset
78 # EXTT1=
dd6e30f7eb42 Initial revision
darius
parents:
diff changeset
79 # PLAYORDER=