Author: tack
Date: Mon Jan  7 09:17:24 2008
New Revision: 2943

Log:
More gracefully handle malformed exif datetime string.


Modified:
   trunk/metadata/src/image/jpg.py

Modified: trunk/metadata/src/image/jpg.py
==============================================================================
--- trunk/metadata/src/image/jpg.py     (original)
+++ trunk/metadata/src/image/jpg.py     Mon Jan  7 09:17:24 2008
@@ -137,8 +137,12 @@
                         if not t:
                             t = exif.get('Image DateTime')
                         if t:
-                            t = time.strptime(str(t), '%Y:%m:%d %H:%M:%S')
-                            self.timestamp = int(time.mktime(t))
+                            try:
+                                t = time.strptime(str(t), '%Y:%m:%d %H:%M:%S')
+                                self.timestamp = int(time.mktime(t))
+                            except ValueError:
+                                # Malformed time string.
+                                pass
                 elif type == 'http://ns.adobe.com/xap/1.0/':
                     # FIXME: parse XMP data (xml)
                     doc = data[data.find('\0')+1:]

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to