mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix for mysterious database entries without paths (corrupt db?)
This commit is contained in:
parent
4d9eb2710f
commit
992070d587
@ -1254,7 +1254,14 @@ class Cache(object):
|
|||||||
if name and not replace:
|
if name and not replace:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
path = self._field_for('path', book_id).replace('/', os.sep)
|
path = self._field_for('path', book_id)
|
||||||
|
if path is None:
|
||||||
|
# Theoretically, this should never happen, but apparently it
|
||||||
|
# does: http://www.mobileread.com/forums/showthread.php?t=233353
|
||||||
|
self._update_path({book_id}, mark_as_dirtied=False)
|
||||||
|
path = self._field_for('path', book_id)
|
||||||
|
|
||||||
|
path = path.replace('/', os.sep)
|
||||||
title = self._field_for('title', book_id, default_value=_('Unknown'))
|
title = self._field_for('title', book_id, default_value=_('Unknown'))
|
||||||
author = self._field_for('authors', book_id, default_value=(_('Unknown'),))[0]
|
author = self._field_for('authors', book_id, default_value=(_('Unknown'),))[0]
|
||||||
stream = stream_or_path if hasattr(stream_or_path, 'read') else lopen(stream_or_path, 'rb')
|
stream = stream_or_path if hasattr(stream_or_path, 'read') else lopen(stream_or_path, 'rb')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user