def audiocd_id(device): (first, last) = _cdrom.toc_header(device) track_frames = [] checksum = 0 for i in range(first, last + 1): (min, sec, frame) = _cdrom.toc_entry(device, i) n = min * 60 + sec while n > 0: checksum += n % 10 n = n / 10 track_frames.append(min * 60 * 75 + sec * 75 + frame) (min, sec, frame) = _cdrom.leadout(device) track_frames.append(min * 60 * 75 + sec * 75 + frame) total_time = (track_frames[-1] / 75) - (track_frames[0] / 75) discid = ((checksum % 0xff) << 24 | total_time << 8 | last) return [discid, last] + track_frames[:-1] + [track_frames[-1] / 75]
def audiocd_id(device): (first, last) = _cdrom.toc_header(device) track_frames = [] checksum = 0 for i in range(first, last + 1): (min, sec, frame) = _cdrom.toc_entry(device, i) n = min*60 + sec while n > 0: checksum += n % 10 n = n / 10 track_frames.append(min*60*75 + sec*75 + frame) (min, sec, frame) = _cdrom.leadout(device) track_frames.append(min*60*75 + sec*75 + frame) total_time = (track_frames[-1] / 75) - (track_frames[0] / 75) discid = ((checksum % 0xff) << 24 | total_time << 8 | last) return [discid, last] + track_frames[:-1] + [ track_frames[-1] / 75 ]
def audiocd_toc_header(device): return _cdrom.toc_header(device)