This commit is contained in:
Kovid Goyal 2012-08-29 09:45:23 +05:30
parent 7e0ac417d7
commit 8c04dc14bd

View File

@ -6,6 +6,7 @@ __copyright__ = '2010, Timothy Legge <timlegge at gmail.com>'
import os import os
import time import time
from calibre.utils.date import parse_date
from calibre.devices.usbms.books import Book as Book_ from calibre.devices.usbms.books import Book as Book_
class Book(Book_): class Book(Book_):
@ -32,9 +33,13 @@ class Book(Book_):
self.datetime = time.strptime(date, "%Y-%m-%dT%H:%M:%S.%f") self.datetime = time.strptime(date, "%Y-%m-%dT%H:%M:%S.%f")
except: except:
try: try:
self.datetime = time.gmtime(os.path.getctime(self.path)) self.datetime = parse_date(date,
assume_utc=True).timetuple()
except: except:
self.datetime = time.gmtime() try:
self.datetime = time.gmtime(os.path.getctime(self.path))
except:
self.datetime = time.gmtime()
else: else:
try: try:
self.datetime = time.gmtime(os.path.getctime(self.path)) self.datetime = time.gmtime(os.path.getctime(self.path))