mirror of
https://github.com/mealie-recipes/mealie.git
synced 2026-01-21 16:31:21 -05:00
Merge branch 'mealie-next' into fix/translation-issues-when-scraping
This commit is contained in:
@@ -218,7 +218,11 @@ class BaseMigrator(BaseService):
|
||||
continue
|
||||
|
||||
if alias.func:
|
||||
prop_value = alias.func(prop_value)
|
||||
try:
|
||||
prop_value = alias.func(prop_value)
|
||||
except Exception as e:
|
||||
self.logger.exception(e)
|
||||
continue
|
||||
|
||||
recipe_dict[alias.key] = prop_value
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ class PaprikaMigrator(BaseMigrator):
|
||||
re_num_list = re.compile(r"^\d+\.\s")
|
||||
|
||||
self.key_aliases = [
|
||||
MigrationAlias(key="recipeIngredient", alias="ingredients", func=lambda x: x.split("\n")),
|
||||
MigrationAlias(key="recipeIngredient", alias="ingredients", func=lambda x: x.split("\n") if x else ""),
|
||||
MigrationAlias(key="orgURL", alias="source_url", func=None),
|
||||
MigrationAlias(key="totalTime", alias="total_time", func=None),
|
||||
MigrationAlias(key="prepTime", alias="prep_time", func=None),
|
||||
@@ -62,7 +62,7 @@ class PaprikaMigrator(BaseMigrator):
|
||||
MigrationAlias(
|
||||
key="recipeInstructions",
|
||||
alias="directions",
|
||||
func=lambda x: [{"text": re.sub(re_num_list, "", s)} for s in x.split("\n\n")],
|
||||
func=lambda x: [{"text": re.sub(re_num_list, "", s)} for s in x.split("\n\n")] if x else [],
|
||||
),
|
||||
]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user