From 40e3b163fa47433017900dc7493c632a2437293b Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 18 Feb 2010 10:12:48 -0700 Subject: [PATCH] Fix catalog date issues --- src/calibre/customize/__init__.py | 7 +++---- src/calibre/library/database2.py | 15 +++++++++------ 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/calibre/customize/__init__.py b/src/calibre/customize/__init__.py index 42b379fa0b..2341ecdf0c 100644 --- a/src/calibre/customize/__init__.py +++ b/src/calibre/customize/__init__.py @@ -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') diff --git a/src/calibre/library/database2.py b/src/calibre/library/database2.py index f1929578f7..3c45acd621 100644 --- a/src/calibre/library/database2.py +++ b/src/calibre/library/database2.py @@ -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