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

📄 player-objects.html

📁 一本很好的python的说明书,适合对python感兴趣的人
💻 HTML
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>18.3.1 Player Objects</title>
<META NAME="description" CONTENT="18.3.1 Player Objects">
<META NAME="keywords" CONTENT="lib">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="STYLESHEET" href="lib.css" tppabs="http://www.python.org/doc/current/lib/lib.css">
<LINK REL="next" href="cd-parser-objects.html" tppabs="http://www.python.org/doc/current/lib/cd-parser-objects.html">
<LINK REL="previous" href="module-cd.html" tppabs="http://www.python.org/doc/current/lib/module-cd.html">
<LINK REL="up" href="module-cd.html" tppabs="http://www.python.org/doc/current/lib/module-cd.html">
<LINK REL="next" href="cd-parser-objects.html" tppabs="http://www.python.org/doc/current/lib/cd-parser-objects.html">
</head>
<body>
<DIV CLASS="navigation"><table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td><A href="module-cd.html" tppabs="http://www.python.org/doc/current/lib/module-cd.html"><img src="previous.gif" tppabs="http://www.python.org/doc/current/icons/previous.gif" border="0" height="32"
  alt="Previous Page" width="32"></A></td>
<td><A href="module-cd.html" tppabs="http://www.python.org/doc/current/lib/module-cd.html"><img src="up.gif" tppabs="http://www.python.org/doc/current/icons/up.gif" border="0" height="32"
  alt="Up One Level" width="32"></A></td>
<td><A href="cd-parser-objects.html" tppabs="http://www.python.org/doc/current/lib/cd-parser-objects.html"><img src="next.gif" tppabs="http://www.python.org/doc/current/icons/next.gif" border="0" height="32"
  alt="Next Page" width="32"></A></td>
<td align="center" width="100%">Python Library Reference</td>
<td><A href="contents.html" tppabs="http://www.python.org/doc/current/lib/contents.html"><img src="contents.gif" tppabs="http://www.python.org/doc/current/icons/contents.gif" border="0" height="32"
  alt="Contents" width="32"></A></td>
<td><a href="modindex.html" tppabs="http://www.python.org/doc/current/lib/modindex.html" title="Module Index"><img src="modules.gif" tppabs="http://www.python.org/doc/current/icons/modules.gif" border="0" height="32"
  alt="Module Index" width="32"></a></td>
<td><A href="genindex.html" tppabs="http://www.python.org/doc/current/lib/genindex.html"><img src="index.gif" tppabs="http://www.python.org/doc/current/icons/index.gif" border="0" height="32"
  alt="Index" width="32"></A></td>
</tr></table>
<b class="navlabel">Previous:</b> <a class="sectref" href="module-cd.html" tppabs="http://www.python.org/doc/current/lib/module-cd.html">18.3 cd  </A>
<b class="navlabel">Up:</b> <a class="sectref" href="module-cd.html" tppabs="http://www.python.org/doc/current/lib/module-cd.html">18.3 cd  </A>
<b class="navlabel">Next:</b> <a class="sectref" href="cd-parser-objects.html" tppabs="http://www.python.org/doc/current/lib/cd-parser-objects.html">18.3.2 Parser Objects</A>
<br><hr></DIV>
<!--End of Navigation Panel-->

<H2>
<BR>
18.3.1 Player Objects
</H2>

<P>
Player objects (returned by <tt class="function">open()</tt>) have the following
methods:

<P>
<dl><dt><b><a name='l2h-3129'><tt class='method'>allowremoval</tt></a></b> ()
<dd>
Unlocks the eject button on the CD-ROM drive permitting the user to
eject the caddy if desired.
</dl>

<P>
<dl><dt><b><a name='l2h-3130'><tt class='method'>bestreadsize</tt></a></b> ()
<dd>
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>

<P>
<dl><dt><b><a name='l2h-3131'><tt class='method'>close</tt></a></b> ()
<dd>
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>

<P>
<dl><dt><b><a name='l2h-3132'><tt class='method'>eject</tt></a></b> ()
<dd>
Ejects the caddy from the CD-ROM drive.
</dl>

<P>
<dl><dt><b><a name='l2h-3133'><tt class='method'>getstatus</tt></a></b> ()
<dd>
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>

<P>
<dl><dt><b><a name='l2h-3134'><tt class='method'>gettrackinfo</tt></a></b> (<var>track</var>)
<dd>
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>

<P>
<dl><dt><b><a name='l2h-3135'><tt class='method'>msftoblock</tt></a></b> (<var>min, sec, frame</var>)
<dd>
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
drives.
</dl>

<P>
<dl><dt><b><a name='l2h-3136'><tt class='method'>play</tt></a></b> (<var>start, play</var>)
<dd>
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
play.
</dl>

<P>
<dl><dt><b><a name='l2h-3137'><tt class='method'>playabs</tt></a></b> (<var>minutes, seconds, frames, play</var>)
<dd>
Like <tt class="method">play()</tt>, except that the start is given in minutes,
seconds, and frames instead of a track number.
</dl>

<P>
<dl><dt><b><a name='l2h-3138'><tt class='method'>playtrack</tt></a></b> (<var>start, play</var>)
<dd>
Like <tt class="method">play()</tt>, except that playing stops at the end of the
track.
</dl>

<P>
<dl><dt><b><a name='l2h-3139'><tt class='method'>playtrackabs</tt></a></b> (<var>track, minutes, seconds, frames, play</var>)
<dd>
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>

<P>
<dl><dt><b><a name='l2h-3140'><tt class='method'>preventremoval</tt></a></b> ()
<dd>
Locks the eject button on the CD-ROM drive thus preventing the user
from arbitrarily ejecting the caddy.
</dl>

<P>
<dl><dt><b><a name='l2h-3141'><tt class='method'>readda</tt></a></b> (<var>num_frames</var>)
<dd>
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>

<P>
<dl><dt><b><a name='l2h-3142'><tt class='method'>seek</tt></a></b> (<var>minutes, seconds, frames</var>)
<dd>
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>

<P>
<dl><dt><b><a name='l2h-3143'><tt class='method'>seekblock</tt></a></b> (<var>block</var>)
<dd>
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>

<P>
<dl><dt><b><a name='l2h-3144'><tt class='method'>seektrack</tt></a></b> (<var>track</var>)
<dd>
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
pointer has been set.
</dl>

<P>
<dl><dt><b><a name='l2h-3145'><tt class='method'>stop</tt></a></b> ()
<dd>
Stops the current playing operation.
</dl>

<P>
<dl><dt><b><a name='l2h-3146'><tt class='method'>togglepause</tt></a></b> ()
<dd>
Pauses the CD if it is playing, and makes it play if it is paused.
</dl>

<P>

<DIV CLASS="navigation"><p><hr><table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td><A href="module-cd.html" tppabs="http://www.python.org/doc/current/lib/module-cd.html"><img src="previous.gif" tppabs="http://www.python.org/doc/current/icons/previous.gif" border="0" height="32"
  alt="Previous Page" width="32"></A></td>
<td><A href="module-cd.html" tppabs="http://www.python.org/doc/current/lib/module-cd.html"><img src="up.gif" tppabs="http://www.python.org/doc/current/icons/up.gif" border="0" height="32"
  alt="Up One Level" width="32"></A></td>
<td><A href="cd-parser-objects.html" tppabs="http://www.python.org/doc/current/lib/cd-parser-objects.html"><img src="next.gif" tppabs="http://www.python.org/doc/current/icons/next.gif" border="0" height="32"
  alt="Next Page" width="32"></A></td>
<td align="center" width="100%">Python Library Reference</td>
<td><A href="contents.html" tppabs="http://www.python.org/doc/current/lib/contents.html"><img src="contents.gif" tppabs="http://www.python.org/doc/current/icons/contents.gif" border="0" height="32"
  alt="Contents" width="32"></A></td>
<td><a href="modindex.html" tppabs="http://www.python.org/doc/current/lib/modindex.html" title="Module Index"><img src="modules.gif" tppabs="http://www.python.org/doc/current/icons/modules.gif" border="0" height="32"
  alt="Module Index" width="32"></a></td>
<td><A href="genindex.html" tppabs="http://www.python.org/doc/current/lib/genindex.html"><img src="index.gif" tppabs="http://www.python.org/doc/current/icons/index.gif" border="0" height="32"
  alt="Index" width="32"></A></td>
</tr></table>
<b class="navlabel">Previous:</b> <a class="sectref" href="module-cd.html" tppabs="http://www.python.org/doc/current/lib/module-cd.html">18.3 cd  </A>
<b class="navlabel">Up:</b> <a class="sectref" href="module-cd.html" tppabs="http://www.python.org/doc/current/lib/module-cd.html">18.3 cd  </A>
<b class="navlabel">Next:</b> <a class="sectref" href="cd-parser-objects.html" tppabs="http://www.python.org/doc/current/lib/cd-parser-objects.html">18.3.2 Parser Objects</A>
</DIV>
<!--End of Navigation Panel-->
<ADDRESS>
<hr>See <i><a href="about.html" tppabs="http://www.python.org/doc/current/lib/about.html">About this document...</a></i> for information on suggesting changes.
</ADDRESS>
</BODY>
</HTML>

⌨️ 快捷键说明

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