mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
When downloading latest version of recipe fallback to builtin one if recipe cannot be compiled
This commit is contained in:
parent
57f3db82e0
commit
08a8f41471
@ -79,7 +79,7 @@ class RecipeInput(InputFormatPlugin):
|
||||
if rtype == 'custom':
|
||||
self.recipe_source = get_custom_recipe(recipe_id)
|
||||
else:
|
||||
self.recipe_source = get_builtin_recipe_by_id(urn)
|
||||
self.recipe_source = get_builtin_recipe_by_id(urn, log=log, download_recipe=True)
|
||||
if not self.recipe_source:
|
||||
raise ValueError('Could not find recipe with urn: ' + urn)
|
||||
if not isinstance(self.recipe_source, bytes):
|
||||
|
@ -218,8 +218,11 @@ def download_builtin_recipe(urn):
|
||||
from calibre.utils.config_base import prefs
|
||||
from calibre.utils.https import get_https_resource_securely
|
||||
import bz2
|
||||
return bz2.decompress(get_https_resource_securely(
|
||||
recipe_source = bz2.decompress(get_https_resource_securely(
|
||||
'https://code.calibre-ebook.com/recipe-compressed/'+urn, headers={'CALIBRE-INSTALL-UUID':prefs['installation_uuid']}))
|
||||
from calibre.web.feeds.recipes import compile_recipe
|
||||
compile_recipe(recipe_source) # ensure the downloaded recipe is at least compile-able
|
||||
return recipe_source
|
||||
|
||||
|
||||
def get_builtin_recipe(urn):
|
||||
|
Loading…
x
Reference in New Issue
Block a user