mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
...
This commit is contained in:
parent
45b96807a3
commit
85ec6eb336
@ -32,7 +32,7 @@ FILTER_INSTALLED = 1
|
||||
FILTER_UPDATE_AVAILABLE = 2
|
||||
FILTER_NOT_INSTALLED = 3
|
||||
|
||||
def get_plugin_updates_available():
|
||||
def get_plugin_updates_available(raise_error=False):
|
||||
'''
|
||||
API exposed to read whether there are updates available for any
|
||||
of the installed user plugins.
|
||||
@ -41,7 +41,7 @@ def get_plugin_updates_available():
|
||||
'''
|
||||
if not has_external_plugins():
|
||||
return None
|
||||
display_plugins = read_available_plugins()
|
||||
display_plugins = read_available_plugins(raise_error=raise_error)
|
||||
if display_plugins:
|
||||
update_plugins = filter(filter_upgradeable_plugins, display_plugins)
|
||||
if len(update_plugins) > 0:
|
||||
@ -54,7 +54,7 @@ def filter_upgradeable_plugins(display_plugin):
|
||||
def filter_not_installed_plugins(display_plugin):
|
||||
return not display_plugin.is_installed()
|
||||
|
||||
def read_available_plugins():
|
||||
def read_available_plugins(raise_error=False):
|
||||
display_plugins = []
|
||||
br = browser()
|
||||
br.set_handle_gzip(True)
|
||||
@ -63,6 +63,8 @@ def read_available_plugins():
|
||||
if not raw:
|
||||
return
|
||||
except:
|
||||
if raise_error:
|
||||
raise
|
||||
traceback.print_exc()
|
||||
return
|
||||
raw = raw.decode('utf-8', errors='replace')
|
||||
|
@ -48,7 +48,7 @@ class CheckForUpdates(QThread):
|
||||
except Exception as e:
|
||||
prints('Failed to check for calibre update:', as_unicode(e))
|
||||
try:
|
||||
update_plugins = get_plugin_updates_available()
|
||||
update_plugins = get_plugin_updates_available(raise_error=True)
|
||||
if update_plugins is not None:
|
||||
plugins_update_found = len(update_plugins)
|
||||
except Exception as e:
|
||||
|
Loading…
x
Reference in New Issue
Block a user