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_UPDATE_AVAILABLE = 2
|
||||||
FILTER_NOT_INSTALLED = 3
|
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
|
API exposed to read whether there are updates available for any
|
||||||
of the installed user plugins.
|
of the installed user plugins.
|
||||||
@ -41,7 +41,7 @@ def get_plugin_updates_available():
|
|||||||
'''
|
'''
|
||||||
if not has_external_plugins():
|
if not has_external_plugins():
|
||||||
return None
|
return None
|
||||||
display_plugins = read_available_plugins()
|
display_plugins = read_available_plugins(raise_error=raise_error)
|
||||||
if display_plugins:
|
if display_plugins:
|
||||||
update_plugins = filter(filter_upgradeable_plugins, display_plugins)
|
update_plugins = filter(filter_upgradeable_plugins, display_plugins)
|
||||||
if len(update_plugins) > 0:
|
if len(update_plugins) > 0:
|
||||||
@ -54,7 +54,7 @@ def filter_upgradeable_plugins(display_plugin):
|
|||||||
def filter_not_installed_plugins(display_plugin):
|
def filter_not_installed_plugins(display_plugin):
|
||||||
return not display_plugin.is_installed()
|
return not display_plugin.is_installed()
|
||||||
|
|
||||||
def read_available_plugins():
|
def read_available_plugins(raise_error=False):
|
||||||
display_plugins = []
|
display_plugins = []
|
||||||
br = browser()
|
br = browser()
|
||||||
br.set_handle_gzip(True)
|
br.set_handle_gzip(True)
|
||||||
@ -63,6 +63,8 @@ def read_available_plugins():
|
|||||||
if not raw:
|
if not raw:
|
||||||
return
|
return
|
||||||
except:
|
except:
|
||||||
|
if raise_error:
|
||||||
|
raise
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
return
|
return
|
||||||
raw = raw.decode('utf-8', errors='replace')
|
raw = raw.decode('utf-8', errors='replace')
|
||||||
|
@ -48,7 +48,7 @@ class CheckForUpdates(QThread):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
prints('Failed to check for calibre update:', as_unicode(e))
|
prints('Failed to check for calibre update:', as_unicode(e))
|
||||||
try:
|
try:
|
||||||
update_plugins = get_plugin_updates_available()
|
update_plugins = get_plugin_updates_available(raise_error=True)
|
||||||
if update_plugins is not None:
|
if update_plugins is not None:
|
||||||
plugins_update_found = len(update_plugins)
|
plugins_update_found = len(update_plugins)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user