Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(4)  |  Call(4)  |  Derive(0)  |  Import(0)

        def get_status(time=0, all=0):
#	cd_open()
	result = 0
	i = 1
	while result == 0 and i < 5:
		try:	# If this fails then it's because it's happening too fast, just retry
			info = ioctl(cd.cd, CDROMSUBCHNL, struct.pack(subchnl_fmt, CDROM_MSF,0,0,0,0,0,0,0))
			drvstatus = get_drive_status()
			result = 1
		except:
			i = i +1
#	cd_close()
	format, status, track, something, absaddr, relmin, relsec, relfrm = struct.unpack(subchnl_fmt, info)
	absmin, abssec, absfrm = struct.unpack(addr_fmt, struct.pack("i", absaddr))
	zero = (1, 0,0,0, 0,0,0)
	if   status == CDROM_AUDIO_PLAY      : cd.status = PLAYING
	elif status == CDROM_AUDIO_PAUSED    : cd.status = PAUSED
	elif status == CDROM_AUDIO_COMPLETED :
		cd.status = STOPPED
		track,relmin,relsec,relfrm,absmin,abssec,absfrm = zero
	elif status == CDROM_AUDIO_ERROR     :
		cd.status = ERROR
		track,relmin,relsec,relfrm,absmin,abssec,absfrm = zero
	elif status == CDROM_AUDIO_INVALID   :
		cd.status = ERROR
		track,relmin,relsec,relfrm,absmin,abssec,absfrm = zero
	elif status == CDROM_AUDIO_NO_STATUS :
		cd.status = NOSTATUS
		track,relmin,relsec,relfrm,absmin,abssec,absfrm = zero
	if   drvstatus == CDS_NO_DISC :
		cd.status = NODISC
		track,relmin,relsec,relfrm,absmin,abssec,absfrm = zero
	if all: return {'status': drvstatus, 'format': format, 'status': status, 'track': track, 'something': something, 'absaddr': absaddr, 'relmin': relmin, 'relsec': relsec, 'relfrm': relfrm}
	elif time: return {'cur_t': track,'rel':(relmin,relsec,relfrm),'abs':(absmin,abssec,absfrm)}
	else: return cd.status
        


src/a/c/AccordionMega-HEAD/rtmidi/pkaudio/pk/stereo/cd_logic.py   AccordionMega(Download)
def get_track_time():
	min, sec, temp = cd.get_status(1)['rel']
	return ((min * 60) + sec)
 
def get_track_time_total(track=None):
def current_track():
	# try:
		temp = cd.get_status(1)
		return int(temp['cur_t'])
	# except:
		return -1
def update():
	try:
		status = cd.get_status()
def get_status():
	""" Returns CD's playing state. Yes, this is just a wrapper around
	    get_status. DEAL. ;)"""
	try:
		status = cd.get_status()