Fix catalog date issues

This commit is contained in:
Kovid Goyal 2010-02-18 10:12:48 -07:00
parent d45da57047
commit 40e3b163fa
2 changed files with 12 additions and 10 deletions

View File

@ -139,12 +139,11 @@ class FileTypePlugin(Plugin):
#: to the database
on_import = False
#: If True, this plugin is run whenever an any2* tool
#: is used, on the file passed to the any2* tool.
#: If True, this plugin is run just before a conversion
on_preprocess = False
#: If True, this plugin is run after an any2* tool is
#: used, on the final file produced by the tool.
#: If True, this plugin is run after conversion
#: on the final file produced by the conversion output plugin.
on_postprocess = False
type = _('File type')

View File

@ -1475,18 +1475,21 @@ class LibraryDatabase2(LibraryDatabase):
self.data.books_added([db_id], self)
self.set_path(db_id, index_is_id=True)
self.conn.commit()
try:
mi = get_metadata(stream,
os.path.splitext(path)[1][1:].lower())
except:
mi = MetaInformation(title, ['calibre'])
mi.tags = [_('Catalog')]
self.set_metadata(db_id, mi)
mi.title, mi.authors = title, ['calibre']
mi.tags = [_('Catalog')]
mi.pubdate = mi.timestamp = nowf()
self.set_metadata(db_id, mi)
self.add_format(db_id, format, stream, index_is_id=True)
if not hasattr(path, 'read'):
stream.close()
self.conn.commit()
if existing:
t = utcnow()
self.set_timestamp(db_id, t, notify=False)
self.set_pubdate(db_id, t, notify=False)
self.data.refresh_ids(self, [db_id]) # Needed to update format list and size
return db_id