Here is a patch that uses the first few bytes of the disc and generates a MD5 digest from that data. My tests using over 100 discs all with same volume and and date generated unique ids. You may find a pair of discs that contain different data that generate the same ID, but the likelihood of it is much lower that the old way of generating the IDs.
-Wayne
Index: discinfo.py =================================================================== RCS file: /cvsroot/mmpython/mmpython/disc/discinfo.py,v retrieving revision 1.18 diff -u -d -r1.18 discinfo.py --- discinfo.py 7 Nov 2003 09:43:40 -0000 1.18 +++ discinfo.py 7 Jan 2004 22:17:35 -0000 @@ -95,6 +95,7 @@ import re import time import array +import md5 from struct import *
@@ -193,7 +194,7 @@ id_cache = {} -def cdrom_disc_id(device, handle_mix=0): +def cdrom_disc_id(device): """ return the disc id of the device or None if no disc is there """ @@ -204,16 +205,16 @@ except: pass - disc_type = cdrom_disc_status(device, handle_mix=handle_mix) + disc_type = cdrom_disc_status(device) if disc_type == 0 or disc_type == 3: return 0, None - elif disc_type == 1 or disc_type == 4: + elif disc_type == 1: disc_id = DiscID.disc_id(device) id = '%08lx_%d' % (disc_id[0], disc_id[1]) else: f = open(device,'rb') - + """ f.seek(0x0000832d) if os.uname()[0] == 'FreeBSD': # why doesn't seeking to 0x0000832d+40 and reading 32 work? @@ -231,7 +232,13 @@ else: label = f.read(32) f.close() - + """ + id = f.read(51200) + f.seek(32808,0) + label = f.read(32) + id_md5 = md5.new() + id_md5.update(id) + id = id_md5.hexdigest() m = re.match("^(.*[^ ]) *$", label) if m: id = '%s%s' % (id, m.group(1))