擅长:python、mysql、java
<p>这个解决方案最简单:</p>
<pre><code>import pyglet
foo=pyglet.media.load("/data/Me/Music/Goo Goo Dolls/[1998] Dizzy Up The Girl/11 - Iris.mp3")
foo.play()
def exiter(dt):
pyglet.app.exit()
print "Song length is: %f" % foo.duration
# foo.duration is the song length
pyglet.clock.schedule_once(exiter, foo.duration)
pyglet.app.run()
</code></pre>
<p>来源:<a href="http://ubuntuforums.org/showthread.php?t=1651906" rel="nofollow">http://ubuntuforums.org/showthread.php?t=1651906</a></p>