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