mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-31 14:33:54 -04:00
Fix #825987 (tag browser is blank)
This commit is contained in:
parent
0cab31a35f
commit
5952c3fce3
@ -122,12 +122,17 @@ class Cache(object):
|
|||||||
formats = self._field_for('formats', book_id)
|
formats = self._field_for('formats', book_id)
|
||||||
mi.format_metadata = {}
|
mi.format_metadata = {}
|
||||||
if not formats:
|
if not formats:
|
||||||
formats = None
|
good_formats = None
|
||||||
else:
|
else:
|
||||||
|
good_formats = []
|
||||||
for f in formats:
|
for f in formats:
|
||||||
|
try:
|
||||||
mi.format_metadata[f] = self._format_metadata(book_id, f)
|
mi.format_metadata[f] = self._format_metadata(book_id, f)
|
||||||
formats = ','.join(formats)
|
except:
|
||||||
mi.formats = formats
|
pass
|
||||||
|
else:
|
||||||
|
good_formats.append(f)
|
||||||
|
mi.formats = good_formats
|
||||||
mi.has_cover = _('Yes') if self._field_for('cover', book_id,
|
mi.has_cover = _('Yes') if self._field_for('cover', book_id,
|
||||||
default_value=False) else ''
|
default_value=False) else ''
|
||||||
mi.tags = list(self._field_for('tags', book_id, default_value=()))
|
mi.tags = list(self._field_for('tags', book_id, default_value=()))
|
||||||
|
@ -925,12 +925,18 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns):
|
|||||||
formats = row[fm['formats']]
|
formats = row[fm['formats']]
|
||||||
mi.format_metadata = {}
|
mi.format_metadata = {}
|
||||||
if not formats:
|
if not formats:
|
||||||
formats = None
|
good_formats = None
|
||||||
else:
|
else:
|
||||||
formats = formats.split(',')
|
formats = formats.split(',')
|
||||||
|
good_formats = []
|
||||||
for f in formats:
|
for f in formats:
|
||||||
|
try:
|
||||||
mi.format_metadata[f] = self.format_metadata(id, f)
|
mi.format_metadata[f] = self.format_metadata(id, f)
|
||||||
mi.formats = formats
|
except:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
good_formats.append(f)
|
||||||
|
mi.formats = good_formats
|
||||||
tags = row[fm['tags']]
|
tags = row[fm['tags']]
|
||||||
if tags:
|
if tags:
|
||||||
mi.tags = [i.strip() for i in tags.split(',')]
|
mi.tags = [i.strip() for i in tags.split(',')]
|
||||||
@ -1213,7 +1219,13 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns):
|
|||||||
except: # If path contains strange characters this throws an exc
|
except: # If path contains strange characters this throws an exc
|
||||||
candidates = []
|
candidates = []
|
||||||
if format and candidates and os.path.exists(candidates[0]):
|
if format and candidates and os.path.exists(candidates[0]):
|
||||||
|
try:
|
||||||
shutil.copyfile(candidates[0], fmt_path)
|
shutil.copyfile(candidates[0], fmt_path)
|
||||||
|
except:
|
||||||
|
# This can happen if candidates[0] or fmt_path is too long,
|
||||||
|
# which can happen if the user copied the library from a
|
||||||
|
# non windows machine to a windows machine.
|
||||||
|
return None
|
||||||
return fmt_path
|
return fmt_path
|
||||||
|
|
||||||
def copy_format_to(self, index, fmt, dest, index_is_id=False):
|
def copy_format_to(self, index, fmt, dest, index_is_id=False):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user