<!DOCTYPE html PUBLIC
"-//W3C//DTD HTML 4.0 Transitional//EN">
<link rel=
"STYLESHEET" href=
"lib.css" type='text/css'
/>
<link rel=
"SHORTCUT ICON" href=
"../icons/pyfav.png" type=
"image/png" />
<link rel='start' href='../index.html' title='Python Documentation Index'
/>
<link rel=
"first" href=
"lib.html" title='Python Library Reference'
/>
<link rel='contents' href='contents.html'
title=
"Contents" />
<link rel='index' href='genindex.html' title='Index'
/>
<link rel='last' href='about.html' title='About this document...'
/>
<link rel='help' href='about.html' title='About this document...'
/>
<link rel=
"next" href=
"cd-parser-objects.html" />
<link rel=
"prev" href=
"module-cd.html" />
<link rel=
"parent" href=
"module-cd.html" />
<link rel=
"next" href=
"cd-parser-objects.html" />
<meta name='aesop' content='information'
/>
<title>20.3.1 Player Objects
</title>
<div id='top-navigation-panel' xml:id='top-navigation-panel'
>
<table align=
"center" width=
"100%" cellpadding=
"0" cellspacing=
"2">
<td class='online-navigation'
><a rel=
"prev" title=
"20.3 cd "
href=
"module-cd.html"><img src='../icons/previous.png'
border='
0' height='
32' alt='Previous Page' width='
32'
/></A></td>
<td class='online-navigation'
><a rel=
"parent" title=
"20.3 cd "
href=
"module-cd.html"><img src='../icons/up.png'
border='
0' height='
32' alt='Up One Level' width='
32'
/></A></td>
<td class='online-navigation'
><a rel=
"next" title=
"20.3.2 Parser Objects"
href=
"cd-parser-objects.html"><img src='../icons/next.png'
border='
0' height='
32' alt='Next Page' width='
32'
/></A></td>
<td align=
"center" width=
"100%">Python Library Reference
</td>
<td class='online-navigation'
><a rel=
"contents" title=
"Table of Contents"
href=
"contents.html"><img src='../icons/contents.png'
border='
0' height='
32' alt='Contents' width='
32'
/></A></td>
<td class='online-navigation'
><a href=
"modindex.html" title=
"Module Index"><img src='../icons/modules.png'
border='
0' height='
32' alt='Module Index' width='
32'
/></a></td>
<td class='online-navigation'
><a rel=
"index" title=
"Index"
href=
"genindex.html"><img src='../icons/index.png'
border='
0' height='
32' alt='Index' width='
32'
/></A></td>
<div class='online-navigation'
>
<b class=
"navlabel">Previous:
</b>
<a class=
"sectref" rel=
"prev" href=
"module-cd.html">20.3 cd
</A>
<b class=
"navlabel">Up:
</b>
<a class=
"sectref" rel=
"parent" href=
"module-cd.html">20.3 cd
</A>
<b class=
"navlabel">Next:
</b>
<a class=
"sectref" rel=
"next" href=
"cd-parser-objects.html">20.3.2 Parser Objects
</A>
<!--End of Navigation Panel-->
<H2><A NAME=
"SECTION0022310000000000000000"></A>
<A NAME=
"player-objects"></A>
Player objects (returned by
<tt class=
"function">open()
</tt>) have the following
<dl><dt><table cellpadding=
"0" cellspacing=
"0"><tr valign=
"baseline">
<td><nobr><b><tt id='l2h-
5088' xml:id='l2h-
5088'
class=
"method">allowremoval
</tt></b>(
</nobr></td>
<td><var></var>)
</td></tr></table></dt>
Unlocks the eject button on the CD-ROM drive permitting the user to
eject the caddy if desired.
<dl><dt><table cellpadding=
"0" cellspacing=
"0"><tr valign=
"baseline">
<td><nobr><b><tt id='l2h-
5089' xml:id='l2h-
5089'
class=
"method">bestreadsize
</tt></b>(
</nobr></td>
<td><var></var>)
</td></tr></table></dt>
Returns the best value to use for the
<var>num_frames
</var> parameter of
the
<tt class=
"method">readda()
</tt> method. Best is defined as the value that
permits a continuous flow of data from the CD-ROM drive.
<dl><dt><table cellpadding=
"0" cellspacing=
"0"><tr valign=
"baseline">
<td><nobr><b><tt id='l2h-
5090' xml:id='l2h-
5090'
class=
"method">close
</tt></b>(
</nobr></td>
<td><var></var>)
</td></tr></table></dt>
Frees the resources associated with the player object. After calling
<tt class=
"method">close()
</tt>, the methods of the object should no longer be used.
<dl><dt><table cellpadding=
"0" cellspacing=
"0"><tr valign=
"baseline">
<td><nobr><b><tt id='l2h-
5091' xml:id='l2h-
5091'
class=
"method">eject
</tt></b>(
</nobr></td>
<td><var></var>)
</td></tr></table></dt>
Ejects the caddy from the CD-ROM drive.
<dl><dt><table cellpadding=
"0" cellspacing=
"0"><tr valign=
"baseline">
<td><nobr><b><tt id='l2h-
5092' xml:id='l2h-
5092'
class=
"method">getstatus
</tt></b>(
</nobr></td>
<td><var></var>)
</td></tr></table></dt>
Returns information pertaining to the current state of the CD-ROM
drive. The returned information is a tuple with the following values:
<var>state
</var>,
<var>track
</var>,
<var>rtime
</var>,
<var>atime
</var>,
<var>ttime
</var>,
<var>first
</var>,
<var>last
</var>,
<var>scsi_audio
</var>,
<var>cur_block
</var>.
<var>rtime
</var> is the time relative to the start of the current track;
<var>atime
</var> is the time relative to the beginning of the disc;
<var>ttime
</var> is the total time on the disc. For more information on
the meaning of the values, see the man page
<span class=
"manpage"><i>CDgetstatus
</i>(
3dm)
</span>.
The value of
<var>state
</var> is one of the following:
<tt class=
"constant">ERROR
</tt>,
<tt class=
"constant">NODISC
</tt>,
<tt class=
"constant">READY
</tt>,
<tt class=
"constant">PLAYING
</tt>,
<tt class=
"constant">PAUSED
</tt>,
<tt class=
"constant">STILL
</tt>, or
<tt class=
"constant">CDROM
</tt>.
<dl><dt><table cellpadding=
"0" cellspacing=
"0"><tr valign=
"baseline">
<td><nobr><b><tt id='l2h-
5093' xml:id='l2h-
5093'
class=
"method">gettrackinfo
</tt></b>(
</nobr></td>
<td><var>track
</var>)
</td></tr></table></dt>
Returns information about the specified track. The returned
information is a tuple consisting of two elements, the start time of
the track and the duration of the track.
<dl><dt><table cellpadding=
"0" cellspacing=
"0"><tr valign=
"baseline">
<td><nobr><b><tt id='l2h-
5094' xml:id='l2h-
5094'
class=
"method">msftoblock
</tt></b>(
</nobr></td>
<td><var>min, sec, frame
</var>)
</td></tr></table></dt>
Converts a minutes, seconds, frames triple representing a time in
absolute time code into the corresponding logical block number for the
given CD-ROM drive. You should use
<tt class=
"function">msftoframe()
</tt> rather than
<tt class=
"method">msftoblock()
</tt> for comparing times. The logical block number
differs from the frame number by an offset required by certain CD-ROM
<dl><dt><table cellpadding=
"0" cellspacing=
"0"><tr valign=
"baseline">
<td><nobr><b><tt id='l2h-
5095' xml:id='l2h-
5095'
class=
"method">play
</tt></b>(
</nobr></td>
<td><var>start, play
</var>)
</td></tr></table></dt>
Starts playback of an audio CD in the CD-ROM drive at the specified
track. The audio output appears on the CD-ROM drive's headphone and
audio jacks (if fitted). Play stops at the end of the disc.
<var>start
</var> is the number of the track at which to start playing the
CD; if
<var>play
</var> is
0, the CD will be set to an initial paused
state. The method
<tt class=
"method">togglepause()
</tt> can then be used to commence
<dl><dt><table cellpadding=
"0" cellspacing=
"0"><tr valign=
"baseline">
<td><nobr><b><tt id='l2h-
5096' xml:id='l2h-
5096'
class=
"method">playabs
</tt></b>(
</nobr></td>
<td><var>minutes, seconds, frames, play
</var>)
</td></tr></table></dt>
Like
<tt class=
"method">play()
</tt>, except that the start is given in minutes,
seconds, and frames instead of a track number.
<dl><dt><table cellpadding=
"0" cellspacing=
"0"><tr valign=
"baseline">
<td><nobr><b><tt id='l2h-
5097' xml:id='l2h-
5097'
class=
"method">playtrack
</tt></b>(
</nobr></td>
<td><var>start, play
</var>)
</td></tr></table></dt>
Like
<tt class=
"method">play()
</tt>, except that playing stops at the end of the
<dl><dt><table cellpadding=
"0" cellspacing=
"0"><tr valign=
"baseline">
<td><nobr><b><tt id='l2h-
5098' xml:id='l2h-
5098'
class=
"method">playtrackabs
</tt></b>(
</nobr></td>
<td><var>track, minutes, seconds, frames, play
</var>)
</td></tr></table></dt>
Like
<tt class=
"method">play()
</tt>, except that playing begins at the specified
absolute time and ends at the end of the specified track.
<dl><dt><table cellpadding=
"0" cellspacing=
"0"><tr valign=
"baseline">
<td><nobr><b><tt id='l2h-
5099' xml:id='l2h-
5099'
class=
"method">preventremoval
</tt></b>(
</nobr></td>
<td><var></var>)
</td></tr></table></dt>
Locks the eject button on the CD-ROM drive thus preventing the user
from arbitrarily ejecting the caddy.
<dl><dt><table cellpadding=
"0" cellspacing=
"0"><tr valign=
"baseline">
<td><nobr><b><tt id='l2h-
5100' xml:id='l2h-
5100'
class=
"method">readda
</tt></b>(
</nobr></td>
<td><var>num_frames
</var>)
</td></tr></table></dt>
Reads the specified number of frames from an audio CD mounted in the
CD-ROM drive. The return value is a string representing the audio
frames. This string can be passed unaltered to the
<tt class=
"method">parseframe()
</tt> method of the parser object.
<dl><dt><table cellpadding=
"0" cellspacing=
"0"><tr valign=
"baseline">
<td><nobr><b><tt id='l2h-
5101' xml:id='l2h-
5101'
class=
"method">seek
</tt></b>(
</nobr></td>
<td><var>minutes, seconds, frames
</var>)
</td></tr></table></dt>
Sets the pointer that indicates the starting point of the next read of
digital audio data from a CD-ROM. The pointer is set to an absolute
time code location specified in
<var>minutes
</var>,
<var>seconds
</var>, and
<var>frames
</var>. The return value is the logical block number to which
the pointer has been set.
<dl><dt><table cellpadding=
"0" cellspacing=
"0"><tr valign=
"baseline">
<td><nobr><b><tt id='l2h-
5102' xml:id='l2h-
5102'
class=
"method">seekblock
</tt></b>(
</nobr></td>
<td><var>block
</var>)
</td></tr></table></dt>
Sets the pointer that indicates the starting point of the next read of
digital audio data from a CD-ROM. The pointer is set to the specified
logical block number. The return value is the logical block number to
which the pointer has been set.
<dl><dt><table cellpadding=
"0" cellspacing=
"0"><tr valign=
"baseline">
<td><nobr><b><tt id='l2h-
5103' xml:id='l2h-
5103'
class=
"method">seektrack
</tt></b>(
</nobr></td>
<td><var>track
</var>)
</td></tr></table></dt>
Sets the pointer that indicates the starting point of the next read of
digital audio data from a CD-ROM. The pointer is set to the specified
track. The return value is the logical block number to which the
<dl><dt><table cellpadding=
"0" cellspacing=
"0"><tr valign=
"baseline">
<td><nobr><b><tt id='l2h-
5104' xml:id='l2h-
5104'
class=
"method">stop
</tt></b>(
</nobr></td>
<td><var></var>)
</td></tr></table></dt>
Stops the current playing operation.
<dl><dt><table cellpadding=
"0" cellspacing=
"0"><tr valign=
"baseline">
<td><nobr><b><tt id='l2h-
5105' xml:id='l2h-
5105'
class=
"method">togglepause
</tt></b>(
</nobr></td>
<td><var></var>)
</td></tr></table></dt>
Pauses the CD if it is playing, and makes it play if it is paused.
<div class='online-navigation'
>
<table align=
"center" width=
"100%" cellpadding=
"0" cellspacing=
"2">
<td class='online-navigation'
><a rel=
"prev" title=
"20.3 cd "
href=
"module-cd.html"><img src='../icons/previous.png'
border='
0' height='
32' alt='Previous Page' width='
32'
/></A></td>
<td class='online-navigation'
><a rel=
"parent" title=
"20.3 cd "
href=
"module-cd.html"><img src='../icons/up.png'
border='
0' height='
32' alt='Up One Level' width='
32'
/></A></td>
<td class='online-navigation'
><a rel=
"next" title=
"20.3.2 Parser Objects"
href=
"cd-parser-objects.html"><img src='../icons/next.png'
border='
0' height='
32' alt='Next Page' width='
32'
/></A></td>
<td align=
"center" width=
"100%">Python Library Reference
</td>
<td class='online-navigation'
><a rel=
"contents" title=
"Table of Contents"
href=
"contents.html"><img src='../icons/contents.png'
border='
0' height='
32' alt='Contents' width='
32'
/></A></td>
<td class='online-navigation'
><a href=
"modindex.html" title=
"Module Index"><img src='../icons/modules.png'
border='
0' height='
32' alt='Module Index' width='
32'
/></a></td>
<td class='online-navigation'
><a rel=
"index" title=
"Index"
href=
"genindex.html"><img src='../icons/index.png'
border='
0' height='
32' alt='Index' width='
32'
/></A></td>
<div class='online-navigation'
>
<b class=
"navlabel">Previous:
</b>
<a class=
"sectref" rel=
"prev" href=
"module-cd.html">20.3 cd
</A>
<b class=
"navlabel">Up:
</b>
<a class=
"sectref" rel=
"parent" href=
"module-cd.html">20.3 cd
</A>
<b class=
"navlabel">Next:
</b>
<a class=
"sectref" rel=
"next" href=
"cd-parser-objects.html">20.3.2 Parser Objects
</A>
<span class=
"release-info">Release
2.4.2, documentation updated on
28 September
2005.
</span>
<!--End of Navigation Panel-->
See
<i><a href=
"about.html">About this document...
</a></i> for information on suggesting changes.