From 1d46d096f8cf3d65e410b39e19bc61f876e0682d Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 21 Mar 2013 11:24:22 +0530 Subject: [PATCH] =?UTF-8?q?BiBTex=20Catalog:=20Fix=20library=5Fname=20fiel?= =?UTF-8?q?d=20causing=20an=20error.=20Fixes=20#1158127=20(Generate=20Cata?= =?UTF-8?q?log=20as=20BibTeX=20=C2=ABKeyError:=20u'library=5Fname'=C2=BB?= =?UTF-8?q?=20error)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/calibre/library/database2.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/calibre/library/database2.py b/src/calibre/library/database2.py index 914de2358b..eed5ec173b 100644 --- a/src/calibre/library/database2.py +++ b/src/calibre/library/database2.py @@ -3626,6 +3626,7 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns): if data['datatype'] == 'series': FIELDS.add('%d_index'%x) data = [] + library_name = os.path.basename(self.library_path) for record in self.data: if record is None: continue db_id = record[self.FIELD_MAP['id']] @@ -3649,6 +3650,7 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns): x['cover'] = os.path.join(path, 'cover.jpg') if not record[self.FIELD_MAP['cover']]: x['cover'] = None + x['library_name'] = library_name formats = self.formats(record[self.FIELD_MAP['id']], index_is_id=True) if formats: for fmt in formats.split(','):