⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 readcd.doc

📁 minimal python variant for small footprint apps like embedded apps
💻 DOC
字号:
Interface to CD-ROM player.This module implements an interface to the built-in cd module.  Theintention is to provide a more user-friendly interface than thebuilt-in module.The module defines a class Readcd with several methods.  Theinitialization of the class will try to open the CD player.  Thismeans that initialization will fail if the CD player is already inuse.  A RuntimeError will be raised by the cd module in that case.The way to work with this module is as follows.  The user specifiesthe parts of the CD that are to be read and he specifies callbackfunctions which are to be called by the system.  At some point he cantell the system to play.  The specified parts of the CD will then beread and the callbacks will be called.Initialization.===============r = readcd.Readcd([cd-player [, mode]])The optional arguments are the name of the CD device and the mode.When "mode" is not specified, it defaults to 'r' (which is the onlypossible value); when "cd-player" also isn't specified, it defaultsto "None" which indicates the default CD player.Methods.========eject() -- Eject the CD from the player.reset() -- Reset the list of data stretches to be played.appendtrack(track) -- Append the specified track to the list of musicstretches.appendstretch(first, last) -- Append the stretch from "first" to "last"to the list of music stretches.  Both "first" and "last" can be in oneof four forms.  "None": for "first", the beginning of the CD, for"last" the end of the CD; a single integer: a track number--playingstarts at the beginning of the track or ends at the end of thespecified track; a three-tuple: the absolute time from the start ofthe CD in minutes, seconds, frames; a four-tuple: track number andrelative time within the track in minutes, seconds, frames.settracks(tracklist) -- The argument is a list of integers.  The listof stretches is set to argument list.  The old list is discarded.setcallback(type, func, arg) -- Set a callback function for "type".The function will be called as func(arg, type, data) where "arg" isthe third argument of setcallback, "type" is the type of callback,"data" is type-dependent data.  See the CDsetcallback(3) manual pagefor more information.  The possible "type" arguments are defined inthe CD module.removecallback(type) -- Remove the callback for "type".gettrackinfo([tracklist]) -- Return a list of tuples.  Each tupleconsists of start and length information of a track.  The start andlength information consist of three-tuples with minutes, seconds andframes.  The optional tracklist argument gives a list of interestingtrack numbers.  If no tracklist is specified, information about alltracks is returned.getstatus() -- Return the status information of the CD.play() -- Play the preprogrammed stretches of music from the CD.  Whennothing was programmed, the whole CD is played.Specifying stretches.=====================There are three methods available to specify a stretch of music to beplayed.  The easiest way is to use "settracklist(tracklist)" with whicha list of tracks can be specified.  "settracklist(tracklist)" isequivalent to the sequence	reset()	for track in tracklist:		appendtrack(track)The next method is "appendtrack(track)" with which a whole track can beadded to the list of music to be played.  "appendtrack(track)" isequivalent to "appendstretch(track, track)".The most complete method is "appendstretch(first, last)".  Using thismethod, it is possible to specify any stretch of music.When two consecutive tracks are played, it is possible to choosewhether the pause that may be between the tracks is played as well orwhether the pause should be skipped.  When the end of a stretch isspecified using a track number and the next stretch starts at thebeginning of the following track and that was also specified using thetrack number (that is, both were specified as integers, not as tuples),the pause is played.  When either value was specified using absolutetime or track-relative time (that is, as three-tuple or asfour-tuple), the pause will not be played.Errors.=======When an error occurs, an exception will be raised.  Depending on wherethe error occurs, the exception may either be "readcd.Error" or"RuntimeError".

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -