Staging
v0.5.1
https://github.com/python/cpython
Raw File
Tip revision: b6b43e00f8ba7ffd142795d2ed2e340e4a897a95 authored by cvs2svn on 08 August 1996, 19:05:09 UTC
This commit was manufactured by cvs2svn to create tag 'r14beta2'.
Tip revision: b6b43e0
listcd.py
# List track info from CD player.

import cd

def main():
	c = cd.open()
	info = []
	while 1:
		try:
			info.append(c.gettrackinfo(len(info) + 1))
		except RuntimeError:
			break
	for i in range(len(info)):
		start, total = info[i]
		print 'Track', zfill(i+1), triple(start), triple(total)

def triple((a, b, c)):
	return zfill(a) + ':' + zfill(b) + ':' + zfill(c)

def zfill(n):
	s = `n`
	return '0' * (2 - len(s)) + s

main()
back to top