Fix #919494 (epub file not copied when changing meta-data)

This commit is contained in:
Kovid Goyal 2012-01-21 08:43:34 +05:30
parent e94340b997
commit 29d31a1fb4
2 changed files with 7 additions and 4 deletions

View File

@ -464,6 +464,7 @@ class Main(MainWindow, MainWindowMixin, DeviceMixin, EmailMixin, # {{{
self.library_view.model().refresh()
self.library_view.model().research()
self.tags_view.recount()
self.library_view.model().db.refresh_format_cache()
elif msg.startswith('shutdown:'):
self.quit(confirm_quit=False)
else:

View File

@ -312,10 +312,7 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns):
load_user_template_functions(self.prefs.get('user_template_functions', []))
# Load the format filename cache
self.format_filename_cache = defaultdict(dict)
for book_id, fmt, name in self.conn.get(
'SELECT book,format,name FROM data'):
self.format_filename_cache[book_id][fmt.upper() if fmt else ''] = name
self.refresh_format_cache()
self.conn.executescript('''
DROP TRIGGER IF EXISTS author_insert_trg;
@ -528,6 +525,11 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns):
''' Return last modified time as a UTC datetime object'''
return utcfromtimestamp(os.stat(self.dbpath).st_mtime)
def refresh_format_cache(self):
self.format_filename_cache = defaultdict(dict)
for book_id, fmt, name in self.conn.get(
'SELECT book,format,name FROM data'):
self.format_filename_cache[book_id][fmt.upper() if fmt else ''] = name
def check_if_modified(self):
if self.last_modified() > self.last_update_check: