Author: dmeyer
Date: Fri Dec 15 16:19:29 2006
New Revision: 2238

Modified:
   trunk/metadata/src/disc/DiscID.py

Log:
oops

Modified: trunk/metadata/src/disc/DiscID.py
==============================================================================
--- trunk/metadata/src/disc/DiscID.py   (original)
+++ trunk/metadata/src/disc/DiscID.py   Fri Dec 15 16:19:29 2006
@@ -23,6 +23,37 @@
 
     return ret
 
+def open(device=None, flags=None):
+    # Allow this function to be called with no arguments,
+    # specifying that we should call cdrom.open() with
+    # no arguments.
+    if device == None:
+        return cdrom.open()
+    elif flags == None:
+        return cdrom.open(device)
+    else:
+        return cdrom.open(device, flags)
+
+def disc_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)
+       checksum = checksum + cddb_sum(min*60 + sec)
+       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 ]
+
 if __name__ == '__main__':
 
     dev_name = None

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to