Merge branch 'develop' into feature/vue3

This commit is contained in:
vabene1111
2024-10-14 17:20:17 +02:00
4 changed files with 15 additions and 6 deletions

View File

@@ -72,14 +72,14 @@ class Mealie(Integration):
) )
recipe.steps.add(step) recipe.steps.add(step)
if 'recipe_yield' in recipe_json: if 'recipe_yield' in recipe_json and recipe_json['recipe_yield'] is not None:
recipe.servings = parse_servings(recipe_json['recipe_yield']) recipe.servings = parse_servings(recipe_json['recipe_yield'])
recipe.servings_text = parse_servings_text(recipe_json['recipe_yield']) recipe.servings_text = parse_servings_text(recipe_json['recipe_yield'])
if 'total_time' in recipe_json and recipe_json['total_time'] is not None: if 'total_time' in recipe_json and recipe_json['total_time'] is not None:
recipe.working_time = parse_time(recipe_json['total_time']) recipe.working_time = parse_time(recipe_json['total_time'])
if 'org_url' in recipe_json: if 'org_url' in recipe_json and recipe_json['org_url'] is not None:
recipe.source_url = recipe_json['org_url'] recipe.source_url = recipe_json['org_url']
recipe.save() recipe.save()

View File

@@ -84,6 +84,11 @@ class Paprika(Integration):
recipe.steps.add(step) recipe.steps.add(step)
# Paprika exports can have images in either of image_url, or photo_data.
# If a user takes an image himself, only photo_data will be set.
# If a user imports an image, both will be set. But the photo_data will be a center-cropped square resized version, so the image_url is preferred.
# Try to download image if possible
try: try:
if recipe_json.get("image_url", None): if recipe_json.get("image_url", None):
url = recipe_json.get("image_url", None) url = recipe_json.get("image_url", None)
@@ -91,6 +96,10 @@ class Paprika(Integration):
response = requests.get(url) response = requests.get(url)
self.import_recipe_image(recipe, BytesIO(response.content)) self.import_recipe_image(recipe, BytesIO(response.content))
except Exception: except Exception:
pass
# If no image downloaded, try to extract from photo_data
if not recipe.image:
if recipe_json.get("photo_data", None): if recipe_json.get("photo_data", None):
self.import_recipe_image(recipe, BytesIO(base64.b64decode(recipe_json['photo_data'])), filetype='.jpeg') self.import_recipe_image(recipe, BytesIO(base64.b64decode(recipe_json['photo_data'])), filetype='.jpeg')

View File

@@ -1,4 +1,4 @@
Django==4.2.15 Django==4.2.16
cryptography===43.0.1 cryptography===43.0.1
django-annoying==0.10.6 django-annoying==0.10.6
django-cleanup==8.0.0 django-cleanup==8.0.0

View File

@@ -5185,9 +5185,9 @@ electron-to-chromium@^1.4.477:
integrity sha512-VTq6vjk3kCfG2qdzQRd/i9dIyVVm0dbtZIgFzrLgfB73mXDQT2HPKVRc1EoZcAVUv9XhXAu08DWqJuababdGGg== integrity sha512-VTq6vjk3kCfG2qdzQRd/i9dIyVVm0dbtZIgFzrLgfB73mXDQT2HPKVRc1EoZcAVUv9XhXAu08DWqJuababdGGg==
elliptic@^6.5.3, elliptic@^6.5.4: elliptic@^6.5.3, elliptic@^6.5.4:
version "6.5.4" version "6.5.7"
resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.5.4.tgz#da37cebd31e79a1367e941b592ed1fbebd58abbb" resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.5.7.tgz#8ec4da2cb2939926a1b9a73619d768207e647c8b"
integrity sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ== integrity sha512-ESVCtTwiA+XhY3wyh24QqRGBoP3rEdDUl3EDUUo9tft074fi19IrdpH7hLCMMP3CIj7jb3W96rn8lt/BqIlt5Q==
dependencies: dependencies:
bn.js "^4.11.9" bn.js "^4.11.9"
brorand "^1.1.0" brorand "^1.1.0"