def __init__(self, *arg): if len(arg) == 0: self.player = cd.open() elif len(arg) == 1: self.player = cd.open(arg[0]) elif len(arg) == 2: self.player = cd.open(arg[0], arg[1]) else: raise Error, 'bad __init__ call' self.list = [] self.callbacks = [(None, None)] * 8 self.parser = cd.createparser() self.playing = 0 self.end = 0 self.status = None self.trackinfo = None
def main(): player = cd.open() stdwin.setdefscrollbars(0, 0) win = stdwin.open('CD') win.player = player win.dispatch = cddispatch mainloop.register(win) win.settimer(10) mainloop.mainloop()
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)
# Class interface to the CD module.
import cd import sys from socket import * import getopt PORT = 50505 # Must match the port in readcd.py def main(): try: optlist, args = getopt.getopt(sys.argv[1:], 'ls') except getopt.error, msg: sys.stderr.write(msg + '\n') sys.exit(2) player = cd.open() prstatus(player) size = player.bestreadsize() if optlist: for opt, arg in optlist: if opt == '-l': prtrackinfo(player) elif opt == '-s': prstatus(player) return if not args: sys.stderr.write('usage: ' + sys.argv[0] + ' host [track]\n') sys.exit(2) host, args = args[0], args[1:]
# List track info from CD player.
# Read CD audio data from the SCSI CD player and send it as UDP # packets to "recvcd.py" on another host. # # Usage: python sendcd.py [options] host [track | minutes seconds [frames]] # # Options: # "-l" list track info and quit. # "-s" display status and quit. # # Arguments: # host host to send the audio data to (required unless -l or -s). # track track number where to start; alternatively, # min sec [frames] absolute address where to start; # default is continue at current point according to status. import cd import sys from socket import * import getopt PORT = 50505 # Must match the port in readcd.py def main(): try: optlist, args = getopt.getopt(sys.argv[1:], 'ls') except getopt.error, msg: sys.stderr.write(msg + '\n') sys.exit(2) player = cd.open() prstatus(player) size = player.bestreadsize() if optlist: for opt, arg in optlist: