Author: dmeyer
Date: Fri Sep 7 11:44:47 2007
New Revision: 2800
Log:
try to make date an int with seconds since epoch
Modified:
trunk/metadata/README
trunk/metadata/TODO
trunk/metadata/src/image/jpg.py
trunk/metadata/src/video/mkv.py
trunk/metadata/src/video/mp4.py
trunk/metadata/src/video/riff.py
Modified: trunk/metadata/README
==============================================================================
--- trunk/metadata/README (original)
+++ trunk/metadata/README Fri Sep 7 11:44:47 2007
@@ -8,3 +8,15 @@
License: GPL
+
+
+Known Bugs:
+
+Date should be returned as int in seconds since the epoch. This should
+be the case for jpg, avi, mp4 and mkv. The mp3 parser returns the date
+as it was set in the ID3 field. Since there is no real standard, this
+can be everything from the year to a complex string. The current
+possible values for ogg and flac are untested, other parser have no
+date field. But checking date for int should mean that the value is
+seconds since epoch.
+
Modified: trunk/metadata/TODO
==============================================================================
--- trunk/metadata/TODO (original)
+++ trunk/metadata/TODO Fri Sep 7 11:44:47 2007
@@ -18,8 +18,6 @@
Check attributes. Some are very similar and could be merged
-Make data int
-
Make bitrate kbit/s
If possible, attributes should match
Modified: trunk/metadata/src/image/jpg.py
==============================================================================
--- trunk/metadata/src/image/jpg.py (original)
+++ trunk/metadata/src/image/jpg.py Fri Sep 7 11:44:47 2007
@@ -33,6 +33,7 @@
# python imports
import struct
+import time
import logging
import cStringIO
@@ -64,7 +65,6 @@
}
EXIFMap = {
- 'Image DateTime': 'date',
'Image Artist': 'artist',
'Image Model': 'hardware',
'Image Software': 'software',
@@ -130,6 +130,12 @@
self.rotation = 270
elif orientation.find('180') > 0:
self.rotation = 180
+ date = exif.get('Image DateTimeOriginal')
+ if not date:
+ date = exif.get('Image DateTime')
+ if date:
+ t = time.strptime(str(date), '%Y:%m:%d %H:%M:%S')
+ self.date = int(time.mktime(t))
elif type == 'http://ns.adobe.com/xap/1.0/':
# FIXME: parse XMP data (xml)
doc = data[data.find('\0')+1:]
Modified: trunk/metadata/src/video/mkv.py
==============================================================================
--- trunk/metadata/src/video/mkv.py (original)
+++ trunk/metadata/src/video/mkv.py Fri Sep 7 11:44:47 2007
@@ -343,7 +343,7 @@
elif ielem_id == MATROSKA_DATE_UTC_ID:
self.date = unpack('!q', ielem.get_data())[0] / 10.0**9
# Date is offset 2001-01-01 00:00:00 (timestamp
978307200.0)
- self.date += 978307200.0
+ self.date = int(self.date + 978307200)
self.length = duration * scalecode / 1000000000.0
Modified: trunk/metadata/src/video/mp4.py
==============================================================================
--- trunk/metadata/src/video/mp4.py (original)
+++ trunk/metadata/src/video/mp4.py Fri Sep 7 11:44:47 2007
@@ -171,10 +171,8 @@
try:
# XXX Date number of Seconds is since January 1st 1904!
# XXX 2082844800 is the difference between Unix and
- # XXX Apple time. Fix me to work on Apple, too
+ # XXX Apple time. FIXME to work on Apple, too
self.date = int(tkhd[1]) - 2082844800
- self.date = time.strftime('%y.%m.%d %H:%M:%S',
- time.gmtime(self.date))
except Exception, e:
log.exception('There was trouble extracting the date')
Modified: trunk/metadata/src/video/riff.py
==============================================================================
--- trunk/metadata/src/video/riff.py (original)
+++ trunk/metadata/src/video/riff.py Fri Sep 7 11:44:47 2007
@@ -477,10 +477,8 @@
log.debug('no support for time format %s',
value)
date = 0
if date:
- # format date to something similar to a date in an
- # EXIF header. This creates one unique way in
- # kaa.metadata to handle this.
- self.date = time.strftime("%Y:%m:%d %H:%M:%S",
date)
+ # save date as int
+ self.date = int(time.mktime(date))
i+=sz
return retval
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog