mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-08-06 22:15:22 +02:00
Feature/import keywords as tags (#1170)
* feat: import original keywords as tags * remove cached env * Update frontend api types * fix: Issues with previous tag scraping implementation * Update category handling in backend * Update backend tests to include group_id * Correct type check * Update create-url interface * Improve tag cleaner list support * remove builtin name shadowing * update type annotations * test include tags scraper * implement scaper context for optional data * readd cache venv * use continue instead of break * remove test callback Co-authored-by: Miroito <alban.vachette@gmail.com>
This commit is contained in:
parent
75c535fb2e
commit
c696dee320
27 changed files with 281 additions and 61 deletions
|
@ -8,6 +8,7 @@ from .recipe_image_types import *
|
|||
from .recipe_ingredient import *
|
||||
from .recipe_notes import *
|
||||
from .recipe_nutrition import *
|
||||
from .recipe_scraper import *
|
||||
from .recipe_settings import *
|
||||
from .recipe_share_token import * # type: ignore
|
||||
from .recipe_step import *
|
||||
|
|
|
@ -41,13 +41,6 @@ class RecipeTool(RecipeTag):
|
|||
on_hand: bool = False
|
||||
|
||||
|
||||
class CreateRecipeByUrl(BaseModel):
|
||||
url: str
|
||||
|
||||
class Config:
|
||||
schema_extra = {"example": {"url": "https://myfavoriterecipes.com/recipes"}}
|
||||
|
||||
|
||||
class CreateRecipeBulk(BaseModel):
|
||||
url: str
|
||||
categories: list[RecipeCategory] = None
|
||||
|
@ -140,21 +133,21 @@ class Recipe(RecipeSummary):
|
|||
if not self.id:
|
||||
raise ValueError("Recipe has no ID")
|
||||
|
||||
dir = app_dirs.RECIPE_DATA_DIR.joinpath(str(self.id))
|
||||
dir.mkdir(exist_ok=True, parents=True)
|
||||
return dir
|
||||
folder = app_dirs.RECIPE_DATA_DIR.joinpath(str(self.id))
|
||||
folder.mkdir(exist_ok=True, parents=True)
|
||||
return folder
|
||||
|
||||
@property
|
||||
def asset_dir(self) -> Path:
|
||||
dir = self.directory.joinpath("assets")
|
||||
dir.mkdir(exist_ok=True, parents=True)
|
||||
return dir
|
||||
folder = self.directory.joinpath("assets")
|
||||
folder.mkdir(exist_ok=True, parents=True)
|
||||
return folder
|
||||
|
||||
@property
|
||||
def image_dir(self) -> Path:
|
||||
dir = self.directory.joinpath("images")
|
||||
dir.mkdir(exist_ok=True, parents=True)
|
||||
return dir
|
||||
folder = self.directory.joinpath("images")
|
||||
folder.mkdir(exist_ok=True, parents=True)
|
||||
return folder
|
||||
|
||||
class Config:
|
||||
orm_mode = True
|
||||
|
|
|
@ -28,6 +28,7 @@ class CategoryBase(CategoryIn):
|
|||
|
||||
class CategoryOut(CategoryBase):
|
||||
slug: str
|
||||
group_id: UUID4
|
||||
|
||||
class Config:
|
||||
orm_mode = True
|
||||
|
|
18
mealie/schema/recipe/recipe_scraper.py
Normal file
18
mealie/schema/recipe/recipe_scraper.py
Normal file
|
@ -0,0 +1,18 @@
|
|||
from mealie.schema._mealie.mealie_model import MealieModel
|
||||
|
||||
|
||||
class ScrapeRecipeTest(MealieModel):
|
||||
url: str
|
||||
|
||||
|
||||
class ScrapeRecipe(MealieModel):
|
||||
url: str
|
||||
include_tags: bool = False
|
||||
|
||||
class Config:
|
||||
schema_extra = {
|
||||
"example": {
|
||||
"url": "https://myfavoriterecipes.com/recipes",
|
||||
"includeTags": True,
|
||||
},
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue