annotate Lib/irix6/readcd.doc @ 5817:48b94de85bf3 legacy-trunk

Extensive changes by AMK.
author Guido van Rossum <guido@python.org>
date Thu, 17 Jul 1997 16:29:42 +0000
parents 6ce61f212c3e
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4964
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
1 Interface to CD-ROM player.
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
2
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
3 This module implements an interface to the built-in cd module. The
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
4 intention is to provide a more user-friendly interface than the
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
5 built-in module.
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
6
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
7 The module defines a class Readcd with several methods. The
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
8 initialization of the class will try to open the CD player. This
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
9 means that initialization will fail if the CD player is already in
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
10 use. A RuntimeError will be raised by the cd module in that case.
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
11
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
12 The way to work with this module is as follows. The user specifies
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
13 the parts of the CD that are to be read and he specifies callback
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
14 functions which are to be called by the system. At some point he can
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
15 tell the system to play. The specified parts of the CD will then be
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
16 read and the callbacks will be called.
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
17
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
18 Initialization.
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
19 ===============
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
20
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
21 r = readcd.Readcd([cd-player [, mode]])
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
22
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
23 The optional arguments are the name of the CD device and the mode.
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
24 When "mode" is not specified, it defaults to 'r' (which is the only
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
25 possible value); when "cd-player" also isn't specified, it defaults
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
26 to "None" which indicates the default CD player.
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
27
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
28 Methods.
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
29 ========
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
30
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
31 eject() -- Eject the CD from the player.
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
32
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
33 reset() -- Reset the list of data stretches to be played.
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
34
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
35 appendtrack(track) -- Append the specified track to the list of music
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
36 stretches.
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
37
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
38 appendstretch(first, last) -- Append the stretch from "first" to "last"
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
39 to the list of music stretches. Both "first" and "last" can be in one
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
40 of four forms. "None": for "first", the beginning of the CD, for
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
41 "last" the end of the CD; a single integer: a track number--playing
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
42 starts at the beginning of the track or ends at the end of the
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
43 specified track; a three-tuple: the absolute time from the start of
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
44 the CD in minutes, seconds, frames; a four-tuple: track number and
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
45 relative time within the track in minutes, seconds, frames.
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
46
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
47 settracks(tracklist) -- The argument is a list of integers. The list
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
48 of stretches is set to argument list. The old list is discarded.
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
49
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
50 setcallback(type, func, arg) -- Set a callback function for "type".
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
51 The function will be called as func(arg, type, data) where "arg" is
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
52 the third argument of setcallback, "type" is the type of callback,
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
53 "data" is type-dependent data. See the CDsetcallback(3) manual page
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
54 for more information. The possible "type" arguments are defined in
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
55 the CD module.
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
56
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
57 removecallback(type) -- Remove the callback for "type".
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
58
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
59 gettrackinfo([tracklist]) -- Return a list of tuples. Each tuple
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
60 consists of start and length information of a track. The start and
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
61 length information consist of three-tuples with minutes, seconds and
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
62 frames. The optional tracklist argument gives a list of interesting
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
63 track numbers. If no tracklist is specified, information about all
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
64 tracks is returned.
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
65
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
66 getstatus() -- Return the status information of the CD.
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
67
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
68 play() -- Play the preprogrammed stretches of music from the CD. When
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
69 nothing was programmed, the whole CD is played.
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
70
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
71 Specifying stretches.
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
72 =====================
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
73
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
74 There are three methods available to specify a stretch of music to be
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
75 played. The easiest way is to use "settracklist(tracklist)" with which
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
76 a list of tracks can be specified. "settracklist(tracklist)" is
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
77 equivalent to the sequence
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
78 reset()
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
79 for track in tracklist:
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
80 appendtrack(track)
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
81
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
82 The next method is "appendtrack(track)" with which a whole track can be
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
83 added to the list of music to be played. "appendtrack(track)" is
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
84 equivalent to "appendstretch(track, track)".
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
85
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
86 The most complete method is "appendstretch(first, last)". Using this
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
87 method, it is possible to specify any stretch of music.
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
88
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
89 When two consecutive tracks are played, it is possible to choose
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
90 whether the pause that may be between the tracks is played as well or
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
91 whether the pause should be skipped. When the end of a stretch is
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
92 specified using a track number and the next stretch starts at the
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
93 beginning of the following track and that was also specified using the
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
94 track number (that is, both were specified as integers, not as tuples),
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
95 the pause is played. When either value was specified using absolute
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
96 time or track-relative time (that is, as three-tuple or as
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
97 four-tuple), the pause will not be played.
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
98
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
99 Errors.
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
100 =======
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
101
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
102 When an error occurs, an exception will be raised. Depending on where
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
103 the error occurs, the exception may either be "readcd.Error" or
6ce61f212c3e Irix 6 specific files -- thanks Sjoerd!
Guido van Rossum <guido@python.org>
parents:
diff changeset
104 "RuntimeError".