Closed GoogleCodeExporter closed 9 years ago
Adding a report method to print the xml datas parsed may be usefull for
debugging
Original comment by bserg...@gmail.com
on 20 Dec 2006 at 9:37
Need to add support for date in XmlItem.setValue (albumdataparser.py).
Here is some code I wrote to convert iPhoto date to proper string
representation:
###
from time import strptime, mktime, strftime, localtime
iPhotoBase = mktime(strptime("2001 01 01 00 00 00", "%Y %m %d %H %M %S"))
testValues = [-12618000.000000, 145631466.000000]
for value in testValues:
photoTime = localtime(value + iPhotoBase)
print value, strftime("%d/%m/%Y %H:%M:%S", photoTime)
Original comment by mathieu....@gmail.com
on 20 Dec 2006 at 9:37
From Panther to Tiger, it looks like the time format changed from a standard
string to a real (float) type, so the
parser cannot work with old files.
Original comment by bserg...@gmail.com
on 20 Dec 2006 at 9:49
Here is how to reproduce it using the test xml file from test/data
python pytof.py -i -l test/data/ -x AlbumData_gnocchi.xml
Original comment by bserg...@gmail.com
on 20 Dec 2006 at 11:31
Here is another code sample for date parsing:
class dateObjFromStringError: pass
def dateObjFromString(text):
""" http://pleac.sourceforge.net/pleac_python/datesandtimes.html """
formats = [
'%A %d %B %Y %Hh%M', # equipetv
'%a, %d %b %Y %H:%M:%S PDT', # orm
'%a, %d %b %Y %H:%M:%S +0200', # radio france
]
for f in formats:
try:
timeobject = time.strptime(text, f)
parsed = True
except (ValueError): pass
if not parsed:
raise dateObjFromStringError
return timeobject
try:
self.curLastDate = dateObjFromString(text)
except (dateObjFromStringError):
self.curLastDate = dateSortedMp3Lister.DC
Original comment by bserg...@gmail.com
on 21 Dec 2006 at 12:52
Fixed in a quite hackish way, there may be a problem ... (so it would be good
to have
unit testing :)
Original comment by bserg...@gmail.com
on 22 Dec 2006 at 10:55
Original issue reported on code.google.com by
bserg...@gmail.com
on 20 Dec 2006 at 4:33