mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Merge from trunk
This commit is contained in:
commit
058ddc1274
@ -151,13 +151,13 @@ def reread_filetype_plugins():
|
|||||||
|
|
||||||
|
|
||||||
def _run_filetype_plugins(path_to_file, ft=None, occasion='preprocess'):
|
def _run_filetype_plugins(path_to_file, ft=None, occasion='preprocess'):
|
||||||
occasion = {'import':_on_import, 'preprocess':_on_preprocess,
|
occasion_plugins = {'import':_on_import, 'preprocess':_on_preprocess,
|
||||||
'postprocess':_on_postprocess}[occasion]
|
'postprocess':_on_postprocess}[occasion]
|
||||||
customization = config['plugin_customization']
|
customization = config['plugin_customization']
|
||||||
if ft is None:
|
if ft is None:
|
||||||
ft = os.path.splitext(path_to_file)[-1].lower().replace('.', '')
|
ft = os.path.splitext(path_to_file)[-1].lower().replace('.', '')
|
||||||
nfp = path_to_file
|
nfp = path_to_file
|
||||||
for plugin in occasion.get(ft, []):
|
for plugin in occasion_plugins.get(ft, []):
|
||||||
if is_disabled(plugin):
|
if is_disabled(plugin):
|
||||||
continue
|
continue
|
||||||
plugin.site_customization = customization.get(plugin.name, '')
|
plugin.site_customization = customization.get(plugin.name, '')
|
||||||
|
@ -782,6 +782,15 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns):
|
|||||||
icon=icon, tooltip=tooltip)
|
icon=icon, tooltip=tooltip)
|
||||||
for r in data if item_not_zero_func(r)]
|
for r in data if item_not_zero_func(r)]
|
||||||
|
|
||||||
|
# Needed for legacy databases that have multiple ratings that
|
||||||
|
# map to n stars
|
||||||
|
for r in categories['rating']:
|
||||||
|
for x in categories['rating']:
|
||||||
|
if r.name == x.name and r.id != x.id:
|
||||||
|
r.count = r.count + x.count
|
||||||
|
categories['rating'].remove(x)
|
||||||
|
break
|
||||||
|
|
||||||
# We delayed computing the standard formats category because it does not
|
# We delayed computing the standard formats category because it does not
|
||||||
# use a view, but is computed dynamically
|
# use a view, but is computed dynamically
|
||||||
categories['formats'] = []
|
categories['formats'] = []
|
||||||
|
Loading…
x
Reference in New Issue
Block a user