home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / pyth_os2.zip / python-1.0.2 / Lib / sgi / readcd.doc < prev    next >
Text File  |  1993-11-08  |  4KB  |  105 lines

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