├── Screenshots_Kindle ├── to delete ├── ex_full.png ├── reviews.png ├── ex_thumb.png ├── homepage.png ├── searchbar.png ├── instructions.png └── category_filter.png ├── app ├── static │ ├── stars.png │ ├── favicon.ico │ └── searchicon.png ├── templates │ ├── image.html │ ├── NoData.html │ ├── recipe.html │ └── landing.html ├── NoData.py ├── api_v1.py ├── __init__.py ├── RecipeParser.py └── RecipeReader.py ├── ExampleRecipes ├── A Very Popular BBQ Sauce │ ├── full.jpg │ ├── thumb.jpg │ ├── thumb16.jpg │ └── recipe.json ├── Air Fryer Fried Pickles │ ├── full.jpg │ ├── thumb.jpg │ ├── thumb16.jpg │ └── recipe.json ├── Balsamic Pork Loin Roast (Instant Pot) │ ├── full.jpg │ ├── thumb.jpg │ ├── thumb16.jpg │ └── recipe.json └── Gâteau Invisible (Invisible Apple Cake) │ ├── full.jpg │ ├── thumb.jpg │ ├── thumb16.jpg │ └── recipe.json ├── requirements.txt ├── .gitignore ├── Dockerfile_alpine ├── Dockerfile ├── .github └── workflows │ ├── stable.yaml │ └── latest.yml ├── README.md └── LICENSE /Screenshots_Kindle/to delete: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /app/static/stars.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NBPub/RecipeBook/HEAD/app/static/stars.png -------------------------------------------------------------------------------- /app/static/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NBPub/RecipeBook/HEAD/app/static/favicon.ico -------------------------------------------------------------------------------- /app/static/searchicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NBPub/RecipeBook/HEAD/app/static/searchicon.png -------------------------------------------------------------------------------- /Screenshots_Kindle/ex_full.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NBPub/RecipeBook/HEAD/Screenshots_Kindle/ex_full.png -------------------------------------------------------------------------------- /Screenshots_Kindle/reviews.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NBPub/RecipeBook/HEAD/Screenshots_Kindle/reviews.png -------------------------------------------------------------------------------- /Screenshots_Kindle/ex_thumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NBPub/RecipeBook/HEAD/Screenshots_Kindle/ex_thumb.png -------------------------------------------------------------------------------- /Screenshots_Kindle/homepage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NBPub/RecipeBook/HEAD/Screenshots_Kindle/homepage.png -------------------------------------------------------------------------------- /Screenshots_Kindle/searchbar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NBPub/RecipeBook/HEAD/Screenshots_Kindle/searchbar.png -------------------------------------------------------------------------------- /Screenshots_Kindle/instructions.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NBPub/RecipeBook/HEAD/Screenshots_Kindle/instructions.png -------------------------------------------------------------------------------- /Screenshots_Kindle/category_filter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NBPub/RecipeBook/HEAD/Screenshots_Kindle/category_filter.png -------------------------------------------------------------------------------- /ExampleRecipes/A Very Popular BBQ Sauce/full.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NBPub/RecipeBook/HEAD/ExampleRecipes/A Very Popular BBQ Sauce/full.jpg -------------------------------------------------------------------------------- /ExampleRecipes/Air Fryer Fried Pickles/full.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NBPub/RecipeBook/HEAD/ExampleRecipes/Air Fryer Fried Pickles/full.jpg -------------------------------------------------------------------------------- /ExampleRecipes/Air Fryer Fried Pickles/thumb.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NBPub/RecipeBook/HEAD/ExampleRecipes/Air Fryer Fried Pickles/thumb.jpg -------------------------------------------------------------------------------- /ExampleRecipes/A Very Popular BBQ Sauce/thumb.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NBPub/RecipeBook/HEAD/ExampleRecipes/A Very Popular BBQ Sauce/thumb.jpg -------------------------------------------------------------------------------- /ExampleRecipes/Air Fryer Fried Pickles/thumb16.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NBPub/RecipeBook/HEAD/ExampleRecipes/Air Fryer Fried Pickles/thumb16.jpg -------------------------------------------------------------------------------- /app/templates/image.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /ExampleRecipes/A Very Popular BBQ Sauce/thumb16.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NBPub/RecipeBook/HEAD/ExampleRecipes/A Very Popular BBQ Sauce/thumb16.jpg -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | click==8.1.3 2 | colorama==0.4.6 3 | Flask==2.2.3 4 | itsdangerous==2.1.2 5 | Jinja2==3.1.2 6 | MarkupSafe==2.1.2 7 | Werkzeug==2.2.3 8 | psutil 9 | -------------------------------------------------------------------------------- /ExampleRecipes/Balsamic Pork Loin Roast (Instant Pot)/full.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NBPub/RecipeBook/HEAD/ExampleRecipes/Balsamic Pork Loin Roast (Instant Pot)/full.jpg -------------------------------------------------------------------------------- /ExampleRecipes/Balsamic Pork Loin Roast (Instant Pot)/thumb.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NBPub/RecipeBook/HEAD/ExampleRecipes/Balsamic Pork Loin Roast (Instant Pot)/thumb.jpg -------------------------------------------------------------------------------- /ExampleRecipes/Gâteau Invisible (Invisible Apple Cake)/full.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NBPub/RecipeBook/HEAD/ExampleRecipes/Gâteau Invisible (Invisible Apple Cake)/full.jpg -------------------------------------------------------------------------------- /ExampleRecipes/Balsamic Pork Loin Roast (Instant Pot)/thumb16.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NBPub/RecipeBook/HEAD/ExampleRecipes/Balsamic Pork Loin Roast (Instant Pot)/thumb16.jpg -------------------------------------------------------------------------------- /ExampleRecipes/Gâteau Invisible (Invisible Apple Cake)/thumb.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NBPub/RecipeBook/HEAD/ExampleRecipes/Gâteau Invisible (Invisible Apple Cake)/thumb.jpg -------------------------------------------------------------------------------- /ExampleRecipes/Gâteau Invisible (Invisible Apple Cake)/thumb16.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NBPub/RecipeBook/HEAD/ExampleRecipes/Gâteau Invisible (Invisible Apple Cake)/thumb16.jpg -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | 4 | # Environments 5 | venv/ 6 | 7 | # Data for testing 8 | /recipe_data 9 | RecipeData.pkl 10 | /app/static/fulls/ 11 | /app/static/thumbs/ 12 | 13 | 14 | -------------------------------------------------------------------------------- /app/NoData.py: -------------------------------------------------------------------------------- 1 | from flask import Blueprint, render_template 2 | from .__init__ import data_path 3 | 4 | bp = Blueprint('NoData', __name__, url_prefix='/') 5 | # Error page for data loading 6 | @bp.route("/", methods = ['GET']) 7 | @bp.route("/recipes/", methods = ['GET']) 8 | def homepage(): 9 | return render_template('NoData.html', data_path=data_path) -------------------------------------------------------------------------------- /app/templates/NoData.html: -------------------------------------------------------------------------------- 1 | 2 | No Recipes! 3 | 4 |

Recipe Data folder not found or empty

5 |

Check that recipes folder is correctly mounted as a volume to "/code/recipe_data", then restart container.

6 |

7 | {{ data_path }} 8 | -------------------------------------------------------------------------------- /app/api_v1.py: -------------------------------------------------------------------------------- 1 | from flask import Blueprint 2 | from psutil import sensors_temperatures, virtual_memory, cpu_percent 3 | from os import getloadavg 4 | 5 | bp = Blueprint('api_v1', __name__, url_prefix='/api') 6 | 7 | @bp.route('/info', methods = ['GET']) 8 | def system_info(): 9 | return { 10 | 'temp':round(sensors_temperatures()['cpu_thermal'][0].current,2), 11 | 'load':[round(val,2) for val in getloadavg()], 12 | 'cpu':cpu_percent(), 13 | 'ram':virtual_memory().percent, 14 | } -------------------------------------------------------------------------------- /Dockerfile_alpine: -------------------------------------------------------------------------------- 1 | # build stage 2 | 3 | FROM python:alpine as builder 4 | 5 | WORKDIR /code 6 | 7 | ENV PYTHONDONTWRITEBYTECODE 1 8 | ENV PYTHONUNBUFFERED 1 9 | 10 | RUN apk --no-cache add curl tzdata build-base linux-headers 11 | 12 | COPY requirements.txt . 13 | RUN pip wheel --no-cache-dir --no-deps --wheel-dir /code/wheels -r requirements.txt 14 | 15 | # final 16 | 17 | FROM python:alpine 18 | 19 | WORKDIR /code 20 | 21 | COPY --from=builder /code/wheels /wheels 22 | COPY --from=builder /code/requirements.txt . 23 | 24 | RUN pip install --no-cache /wheels/* 25 | 26 | COPY /app/ ./app 27 | 28 | ENTRYPOINT flask run --host=0.0.0.0 -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | # build stage 2 | 3 | FROM python:slim-bullseye as builder 4 | 5 | WORKDIR /code 6 | 7 | ENV PYTHONDONTWRITEBYTECODE 1 8 | ENV PYTHONUNBUFFERED 1 9 | 10 | RUN apt-get update && \ 11 | apt-get upgrade -y && \ 12 | apt-get install -y --no-install-recommends gcc python3-dev 13 | 14 | COPY requirements.txt . 15 | RUN pip wheel --no-cache-dir --no-deps --wheel-dir /code/wheels -r requirements.txt 16 | 17 | # final 18 | 19 | FROM python:slim-bullseye 20 | 21 | WORKDIR /code 22 | 23 | COPY --from=builder /code/wheels /wheels 24 | COPY --from=builder /code/requirements.txt . 25 | 26 | RUN pip install --no-cache /wheels/* 27 | 28 | COPY /app/ ./app 29 | 30 | ENTRYPOINT flask run --host=0.0.0.0 -------------------------------------------------------------------------------- /.github/workflows/stable.yaml: -------------------------------------------------------------------------------- 1 | name: Stable Release Docker Image CI 2 | 3 | on: 4 | release: 5 | types: [published] 6 | 7 | jobs: 8 | docker: 9 | runs-on: ubuntu-latest 10 | steps: 11 | - 12 | name: Set up QEMU 13 | uses: docker/setup-qemu-action@v2 14 | - 15 | name: Set up Docker Buildx 16 | uses: docker/setup-buildx-action@v2 17 | - 18 | name: Login to Docker Hub 19 | uses: docker/login-action@v2 20 | with: 21 | username: ${{ secrets.DOCKERHUB_USERNAME }} 22 | password: ${{ secrets.DOCKERHUB_TOKEN }} 23 | - 24 | name: Build and push 25 | uses: docker/build-push-action@v3 26 | with: 27 | push: true 28 | platforms: linux/arm64, linux/amd64, linux/arm/v7 29 | tags: nbpub/recipelook:debian-${{ github.ref_name }} 30 | - 31 | name: Build and push alpine 32 | uses: docker/build-push-action@v3 33 | with: 34 | push: true 35 | file: ./Dockerfile_alpine 36 | platforms: linux/arm64, linux/amd64, linux/arm/v7 37 | tags: nbpub/recipelook:${{ github.ref_name }} -------------------------------------------------------------------------------- /.github/workflows/latest.yml: -------------------------------------------------------------------------------- 1 | # name: Latest Docker Image CI 2 | 3 | # on: 4 | # push: 5 | # branches: 6 | # - 'main' 7 | 8 | # jobs: 9 | # docker: 10 | # runs-on: ubuntu-latest 11 | # steps: 12 | # - 13 | # name: Set up QEMU 14 | # uses: docker/setup-qemu-action@v2 15 | # - 16 | # name: Set up Docker Buildx 17 | # uses: docker/setup-buildx-action@v2 18 | # - 19 | # name: Login to Docker Hub 20 | # uses: docker/login-action@v2 21 | # with: 22 | # username: ${{ secrets.DOCKERHUB_USERNAME }} 23 | # password: ${{ secrets.DOCKERHUB_TOKEN }} 24 | # - 25 | # name: Build and push 26 | # uses: docker/build-push-action@v3 27 | # with: 28 | # push: true 29 | # platforms: linux/arm64, linux/amd64, linux/arm/v7 30 | # tags: nbpub/recipelook:debian-latest 31 | # - 32 | # name: Build and push alpine 33 | # uses: docker/build-push-action@v3 34 | # with: 35 | # push: true 36 | # file: ./Dockerfile_alpine 37 | # platforms: linux/arm64, linux/amd64, linux/arm/v7 38 | # tags: nbpub/recipelook:latest -------------------------------------------------------------------------------- /app/__init__.py: -------------------------------------------------------------------------------- 1 | from flask import Flask 2 | import logging 3 | from os import getenv 4 | from pathlib import Path 5 | 6 | #Load in Environmental Variables 7 | HomePageTitle = getenv('PAGE_TITLE','Recipe Book') 8 | LargeFont = f'{getenv("FONT_LARGE","36")}px' 9 | SmallFont = f'{getenv("FONT_SMALL","30")}px' 10 | imagetypeEnv = getenv('IMAGE_SIZE','Full') 11 | if imagetypeEnv == 'Thumbnail': 12 | imagetype = 'thumbs' 13 | else: 14 | imagetype = 'fulls' 15 | del imagetypeEnv 16 | 17 | # recipes folder, could let user specify later 18 | data_path = Path(Path.cwd(), 'recipe_data') 19 | 20 | def create_app(test_config=None): 21 | app = Flask(__name__) # application factory 22 | 23 | # When starting: parse recipe data, and save as pickle 24 | if not(Path(Path.cwd(), 'RecipeData.pkl').exists()): 25 | from .RecipeParser import RecipeParser 26 | check = RecipeParser(data_path, app) 27 | else: 28 | check = True 29 | # Provide error page if no recipe data found 30 | if not check: 31 | from . import NoData 32 | app.register_blueprint(NoData.bp) 33 | return app 34 | 35 | # register main Blueprint 36 | from . import RecipeReader 37 | app.register_blueprint(RecipeReader.bp) 38 | 39 | # register API if enabled 40 | enable_api = getenv('ENABLE_API', False) 41 | if type(enable_api) == str and enable_api.lower() == 'true': 42 | from . import api_v1 43 | app.register_blueprint(api_v1.bp) 44 | app.logger.info('API enabled at */api/info') 45 | else: 46 | app.logger.info('API disabled, set "ENABLE_API=True" to enable') 47 | 48 | app.logger.info('. . . starting RecipeBook . . .') 49 | if not app.debug: 50 | app.logger.setLevel(logging.INFO) # adjust later 51 | else: 52 | app.logger.setLevel(logging.INFO) 53 | return app -------------------------------------------------------------------------------- /app/RecipeParser.py: -------------------------------------------------------------------------------- 1 | # from flask import current_app 2 | from pathlib import Path 3 | import json 4 | import pickle as pickle 5 | from shutil import copy 6 | 7 | def RecipeParser(recipe_data_path, current_app): 8 | # check folder 9 | current_app.logger.info('Reading recipe data. . .') 10 | current_app.logger.info(recipe_data_path) 11 | if not recipe_data_path.is_dir(): 12 | current_app.logger.info('No recipe data found! Mount volume and restart container.') 13 | return False 14 | 15 | img_full = Path(Path.cwd(), 'app', 'static', 'fulls') 16 | img_thumb = Path(Path.cwd(), 'app', 'static', 'thumbs') 17 | if not img_full.exists(): 18 | img_full.mkdir() 19 | if not img_thumb.exists(): 20 | img_thumb.mkdir() 21 | 22 | RecipeName = {} 23 | RecipeCategory = {} 24 | PageName = {} 25 | JSONPath = {} 26 | ImagePath = {} 27 | 28 | for i,val in enumerate(recipe_data_path.iterdir()): 29 | JSONPath[i] = Path(val, 'recipe.json') # Path to recipe data for page loading 30 | 31 | with open(JSONPath[i], 'r') as file: 32 | data = json.load(file) 33 | # Save recipe name without any special characters, and without spaces for URLs 34 | RecipeName[i] = "".join(char for char in data["name"] if char.isalnum() or char == ' ') 35 | PageName[RecipeName[i].replace(' ','')] = i 36 | 37 | if 'recipeCategory' in data: 38 | RecipeCategory[i] = data['recipeCategory'] # Categories for filter buttons 39 | else: 40 | RecipeCategory[i] = 'Not Assigned' 41 | 42 | if Path(val, 'full.jpg').exists(): # image types: thumb.jpg, full.jpg, thumb16.jpg (icon) 43 | copy(Path(val, 'full.jpg'), Path(img_full, f'{RecipeName[i]}.jpg')) 44 | copy(Path(val, 'thumb.jpg'), Path(img_thumb, f'{RecipeName[i]}.jpg')) 45 | ImagePath[i] = f'{RecipeName[i]}.jpg' 46 | 47 | # save parsed JSON data as pickle 48 | with open(Path(Path.cwd(), 'RecipeData.pkl'), 'wb') as f: 49 | pickle.dump([RecipeName,RecipeCategory, PageName, JSONPath, ImagePath], f) 50 | return True -------------------------------------------------------------------------------- /app/templates/recipe.html: -------------------------------------------------------------------------------- 1 | 2 | {{ title }} 3 | 46 | 47 | 48 |
49 | 50 |
51 | 52 | 53 | {% if image %} 54 | {% if image[0] == 'f' %} 55 |
56 | 57 |
58 | {% elif image[0] == 't' %} 59 |
60 | 61 |
62 | {% endif %} 63 | {% endif %} 64 |
65 | 66 | 67 |
68 | 69 |
70 |
71 | 72 |
73 | 74 |

{{ name }}

75 |

{{ description }}

76 | {% if image %} 77 |

78 | {% endif %} 79 |

80 | 81 |

Ingredients

82 | 87 |

88 | 89 |

Instructions

90 |
    91 | {% for item in instructions %} 92 |
  1. {{item}}

  2. 93 | {% endfor %} 94 |
95 |

96 | 97 |

Reviews

98 | {% if avgrating %} 99 | 100 | {% endif %} 101 | 106 |

-------------------------------------------------------------------------------- /ExampleRecipes/Balsamic Pork Loin Roast (Instant Pot)/recipe.json: -------------------------------------------------------------------------------- 1 | {"@context":"http:\/\/schema.org","@type":"Recipe","name":"Balsamic Pork Loin Roast (Instant Pot)","author":{"@type":"Person","name":"Sandy Clifton"},"description":"Instant Pot Balsamic Pork Loin Roast has a deep, rich and tangy flavor. The balsamic reduction sauce over the pork roast is amazing!","datePublished":"2019-07-03T09:34:34+00:00","image":"https:\/\/www.simplyhappyfoodie.com\/wp-content\/uploads\/2019\/07\/instant-pot-pork-loin-3-480x270.jpg","recipeYield":1,"prepTime":"PT0H17M","cookTime":"PT0H35M","totalTime":"PT1H12M","recipeIngredient":["2 lb Pork Loin Roast* ((not tenderloin) boneless)","2 tsp Kosher Salt, (divided)","1 tsp Pepper, (divided)","1 Tbsp Olive Oil","1 Onion, (sliced into thick rounds)","1 tsp Garlic Powder","1\/3 cup Apple Cider","1\/3 cup Balsamic Vinegar ((good quality))","1 Apple, (sliced thick (core it, but no need to peel))","3 Tbsp Corn Starch","3 Tbsp Cold Water","2 Tbsp Honey"],"recipeInstructions":["Salt and pepper all sides of the roast, using 1 tsp of the salt and 1\/2 tsp of the pepper. Set aside.","Turn on the Saut\u00e9 setting. When hot, add the oil.","Add the pork roast and and onion. Brown the roast for 2-3 minutes per side. Then remove it to a plate.","Sprinkle the garlic powder, and remaining salt and pepper over the onions.","Add the apple cider, and when it starts to simmer, stir, scraping the bottom of the pot to get up all of the browned bits (deglaze).","Pour in the balsamic vinegar.","Add the apple slices to the pot and then set the roast on top.","Cancel the saut\u00e9 setting.","Close the lid and set the steam release knob to the Sealing position.","Press the Pressure Cook\/Manual button or dial, then the +\/- button or dial to select 30 minutes. High Pressure. (if your roast is larger than 2.5 pounds, or is bone-in, add 10 minutes cook time per pound.). The pot will take several minutes to come to pressure.","When the cook cycle has finished, turn off the pot and let it sit undisturbed for 12 minutes (12 minute natural release). Then turn the steam release knob to the Venting position to release the remaining steam\/pressure.","When the pin in the lid drops back down, open the lid.","Take the temperature of the roast. It should be close to 145\u00b0 F. If it is much below that (by 10 degrees or more), place the lid back on the pot and seal it. Then set time for \"0\" minutes and after it is done, let it sit 5 minutes before releasing pressure and opening it.","Remove the roast to a plate and loosely cover with foil.","Whisk together the corn starch and the cold water. Set aside.","Turn the saut\u00e9 setting on and when it starts to simmer, stir in the corn starch slurry. Keep stirring until the sauce thickens.","Turn off the pot and stir in the honey. Taste the sauce and adjust seasonings if desired. You can add more honey if you like it sweeter.","Transfer roast to a serving dish, slice it, and pour some of the sauce over it.","Serve each portion with some of the extra sauce."],"aggregateRating":{"@type":"AggregateRating","ratingValue":"4.93","ratingCount":"13"},"recipeCategory":"Instant Pot","recipeCuisine":["American"],"keywords":"pressure cooker apple cider pork roast","nutrition":{"@type":"NutritionInformation","calories":"463 kcal","servingSize":"1 serving"},"@id":"https:\/\/www.simplyhappyfoodie.com\/instant-pot-balsamic-pork-loin\/#recipe","isPartOf":{"@id":"https:\/\/www.simplyhappyfoodie.com\/instant-pot-balsamic-pork-loin\/#article"},"mainEntityOfPage":"https:\/\/www.simplyhappyfoodie.com\/instant-pot-balsamic-pork-loin\/#webpage","url":"https:\/\/www.simplyhappyfoodie.com\/instant-pot-balsamic-pork-loin\/#wprm-recipe-container-9081","id":264,"dateCreated":"0","dateModified":"2021-02-03T01:30:03+0000","printImage":false,"imageUrl":"\/apps\/cookbook\/recipes\/264\/image?size=full","tool":[]} -------------------------------------------------------------------------------- /app/RecipeReader.py: -------------------------------------------------------------------------------- 1 | from pathlib import Path 2 | from flask import Blueprint, render_template, request, json, current_app 3 | import pickle as pickle 4 | from .RecipeParser import RecipeParser 5 | 6 | # environmental variables + recipes folder 7 | from .__init__ import data_path, HomePageTitle, LargeFont, SmallFont, imagetype 8 | 9 | # Function to parse recipe data, refresh to parse recipe folder if changes are made 10 | def Refresh(): 11 | RecipeParser(data_path, current_app) 12 | 13 | bp = Blueprint('RecipeReader', __name__, url_prefix='/') 14 | # Landing Page, list of recipes 15 | # POST methods for refresh or returning to category functions 16 | @bp.route("/", methods = ['GET','POST']) 17 | @bp.route("/recipes/", methods = ['GET','POST']) 18 | def homepage(): 19 | if request.method == 'POST': 20 | if request.form.get('reload') == 'Refresh List': 21 | Refresh() 22 | if request.form.get('cat-select') != None: # category filter 23 | ActiveCat = request.form.get('cat-select') 24 | else: 25 | ActiveCat = 'Show all' 26 | else: 27 | ActiveCat = 'Show all' 28 | 29 | with open(Path(Path.cwd(), 'RecipeData.pkl'), 'rb') as f: 30 | RecipeName, RecipeCategory, PageName, JSONPath, ImagePath = pickle.load(f) 31 | del f, JSONPath, ImagePath 32 | 33 | Categories = list(set(RecipeCategory.values())) # unique categories for filter buttons 34 | Categories.insert(0,'Show all') # Add show all button 35 | 36 | return render_template('landing.html', RecipeName=RecipeName, ActiveCat=ActiveCat, \ 37 | PageName=PageName, HomePageTitle=HomePageTitle, \ 38 | Categories=Categories, RecipeCategory=RecipeCategory) 39 | 40 | 41 | # Recipes Page, gather data from JSON to serve to jinja template 42 | @bp.route('/recipes/', methods = ['GET','POST']) 43 | def showpage(page): 44 | with open(Path(Path.cwd(), 'RecipeData.pkl'), 'rb') as f: 45 | RecipeName, RecipeCategory, PageName, JSONPath, ImagePath = pickle.load(f) 46 | del f 47 | index = PageName[page] # recipe index to fetch associated data 48 | title = RecipeName[index] 49 | category = RecipeCategory[index] 50 | del PageName, RecipeName, RecipeCategory 51 | 52 | if request.method == 'POST': # Change image path (thumb vs full) if button pressed 53 | if request.form.get('imswitch') == 'Reduce Image Size': 54 | image = f'thumbs/{ImagePath[index]}' 55 | elif request.form.get('imswitch') == 'Restore Image Size': 56 | image = f'fulls/{ImagePath[index]}' 57 | 58 | elif request.method == 'GET': # Provide default image size if not 59 | if index in ImagePath: 60 | image = f'{imagetype}/{ImagePath[index]}' 61 | else: 62 | image = '' 63 | del ImagePath 64 | 65 | # Recipe data 66 | with open(JSONPath[index],'r') as file: 67 | data = json.load(file) 68 | del file 69 | 70 | name = data["name"] 71 | description = data["description"] 72 | ingredients = data["recipeIngredient"] 73 | instructions = data["recipeInstructions"] 74 | 75 | reviews = [] 76 | ratings = [] 77 | avgrating = '' 78 | 79 | if 'review' in data: 80 | for i,val in enumerate(data['review']): 81 | base = '' 82 | if 'reviewRating' in val: 83 | rating = int(val['reviewRating']['ratingValue']) 84 | ratings.append(rating) 85 | base = base + f'({rating}/5) ' 86 | if 'reviewBody' in val: 87 | base = base + val['reviewBody'] 88 | elif 'description' in val: 89 | base = base + val['description'] 90 | try: 91 | base = f' {base} ~{val["author"]["name"]}' 92 | except: 93 | pass 94 | 95 | reviews.append(base) 96 | 97 | if len(ratings) > 0: 98 | avgrating = sum(ratings)/len(ratings) 99 | del ratings 100 | else: 101 | reviews = '' 102 | 103 | return render_template('recipe.html', LargeFont=LargeFont, SmallFont=SmallFont, \ 104 | category=category, page=page, title=title, image=image, \ 105 | name=name, description=description, ingredients=ingredients, \ 106 | instructions=instructions, reviews=reviews, avgrating=avgrating) 107 | 108 | @bp.route("/favicon.ico") 109 | def favicon(): 110 | image = "favicon.ico" 111 | return render_template('image.html', image=image) 112 | -------------------------------------------------------------------------------- /app/templates/landing.html: -------------------------------------------------------------------------------- 1 | 2 | {{ HomePageTitle }} 3 | 72 | 73 |

{{ HomePageTitle }} Recipes

74 |
75 | 76 |
77 | 78 | 79 |
80 | 81 |

Categories

82 |
83 | {% for item in Categories %} 84 | {% if ActiveCat == item %} 85 | 86 | {% else %} 87 | 88 | {% endif %} 89 | {% endfor %} 90 |
91 | 92 |

Recipe List

93 |
94 | 99 |
100 | 101 | 102 | 103 | -------------------------------------------------------------------------------- /ExampleRecipes/Air Fryer Fried Pickles/recipe.json: -------------------------------------------------------------------------------- 1 | {"@graph":[{"@type":"Question","text":"Which do you prefer?","suggestedAnswer":[{"@type":"Answer","text":"Panko"},{"@type":"Answer","text":"Bread Crumbs"}]}],"@context":"http:\/\/schema.org","url":"https:\/\/www.delish.com\/cooking\/recipe-ideas\/a19684034\/air-fryer-fried-pickles-recipe\/","publisher":{"@type":"Organization","name":"Delish","logo":{"@type":"ImageObject","url":"https:\/\/assets.hearstapps.com\/sites\/delish\/assets\/images\/logos\/logo-jsonld.58eed96.png","width":"219","height":"60"}},"@type":"Recipe","author":{"name":"Lena Abraham","@type":"Person"},"datePublished":"2018-04-06T20:16:00.728137Z","headline":"Air Fryer Fried Pickles","image":"https:\/\/hips.hearstapps.com\/hmg-prod.s3.amazonaws.com\/images\/delish-190620-air-fryer-pickles-0418-landscape-pf-1564069489.jpg","mainEntityOfPage":{"@id":"https:\/\/www.delish.com\/cooking\/recipe-ideas\/a19684034\/air-fryer-fried-pickles-recipe\/","@type":"WebPage"},"thumbnailUrl":"https:\/\/hips.hearstapps.com\/hmg-prod.s3.amazonaws.com\/images\/delish-190620-air-fryer-pickles-0418-landscape-pf-1564069489.jpg?crop=0.668xw:1.00xh;0.167xw,0&resize=100:*","dateModified":"2021-01-13T21:03:50+0000","name":"Air Fryer Fried Pickles","prepTime":"PT0H10M","cookTime":"PT0H0M","totalTime":"PT0H55M","recipeIngredient":["2 c. dill pickle slices","1 egg, whisked with 1 tbsp. water","1\/2 c. bread crumbs","1\/4 c. freshly grated Parmesan","1 tsp. dried oregano","1 tsp. garlic powder","Ranch, for dipping"],"recipeInstructions":["Using paper towels, pat pickle chips dry. In a medium bowl, stir together bread crumbs, Parmesan, oregano, and garlic powder."," Dredge pickle chips first in egg and then in the bread crumb mixture. Working in batches, place in a single layer in\u00a0air fryer basket. Cook at 400\u00b0\u00a0for\u00a010 minutes.\u00a0 ","Serve warm\u00a0with ranch."],"video":{"@type":"VideoObject","contentUrl":"https:\/\/streaming.hearstdigitalstudios.com\/a8fc263d-30bb-4781-b229-c2acee13c98b\/video_rover_16x9_1080p_hd_1523044817_63633.mp4","description":"So. Damn. Good.","duration":"PT39S","embedUrl":"https:\/\/glimmer.hearstapps.com\/?id=b2894f8a-a9c3-4d2a-86ab-ee6c7e7cea5b","name":"These Air Fryer Fried Pickles Make The Best Healthy Snack","thumbnailUrl":"https:\/\/hips.hearstapps.com\/hmg-prod\/images\/delish-190620-air-fryer-pickles-0418-landscape-pf-1564069489.jpg","uploadDate":"2018-04-06T19:59:48.796585Z"},"aggregateRating":{"@context":"http:\/\/schema.org\/","@type":"AggregateRating","ratingValue":"3.75","reviewCount":"8","worstRating":"1","bestRating":"5"},"review":[{"@context":"http:\/\/schema.org\/","@type":"Review","datePublished":"2020-03-07","author":{"@context":"http:\/\/schema.org\/","@type":"Person","name":"GoldCocktail"},"reviewBody":"Made these today but changed a bit to make gluten free recipe. Mixed GF Panko and cornmeal, about 1 to 1 ratio, and left out Parmesan. Add cornstarch to the egg mixture to make crumbs adhere better.\n\nWent great with our burgers!","reviewRating":{"@context":"http:\/\/schema.org\/","@type":"Rating","ratingValue":"5","worstRating":"1","bestRating":"5"}},{"@context":"http:\/\/schema.org\/","@type":"Review","datePublished":"2020-01-18","author":{"@context":"http:\/\/schema.org\/","@type":"Person","name":"RedScissors"},"reviewBody":"Used panko, but everything else according to the recipe. They were just eh. I\u2019ll continue to try other recipes.","reviewRating":{"@context":"http:\/\/schema.org\/","@type":"Rating","ratingValue":"2","worstRating":"1","bestRating":"5"}},{"@context":"http:\/\/schema.org\/","@type":"Review","datePublished":"2020-02-17","author":{"@context":"http:\/\/schema.org\/","@type":"Person","name":"BlueGlasses"},"reviewBody":"Tried them tonight. They were pretty good, especially since they were air fried. We will make them again.","reviewRating":{"@context":"http:\/\/schema.org\/","@type":"Rating","ratingValue":"4","worstRating":"1","bestRating":"5"}},{"@context":"http:\/\/schema.org\/","@type":"Review","datePublished":"2019-04-13","author":{"@context":"http:\/\/schema.org\/","@type":"Person","name":" Olive Fries"},"reviewBody":"The breading flavor is super plain. Needs more flavor. And you just need to do 400\u00b0 for 8 minutes, flip halfway through if you want to crips both sides equally but it\u2019s not necessary!","reviewRating":{"@context":"http:\/\/schema.org\/","@type":"Rating","ratingValue":"4","worstRating":"1","bestRating":"5"}},{"@context":"http:\/\/schema.org\/","@type":"Review","datePublished":"2019-11-10","author":{"@context":"http:\/\/schema.org\/","@type":"Person","name":"PurpleAnchor"},"reviewBody":"Loveeeeeee this recipe!!! It\u2019s so simple and tastes so good!!!!","reviewRating":{"@context":"http:\/\/schema.org\/","@type":"Rating","ratingValue":"5","worstRating":"1","bestRating":"5"}},{"@context":"http:\/\/schema.org\/","@type":"Review","datePublished":"2020-02-07","author":{"@context":"http:\/\/schema.org\/","@type":"Person","name":"CyanSailboat"},"reviewBody":"Awful!","reviewRating":{"@context":"http:\/\/schema.org\/","@type":"Rating","ratingValue":"1","worstRating":"1","bestRating":"5"}},{"@context":"http:\/\/schema.org\/","@type":"Review","datePublished":"2019-12-15","author":{"@context":"http:\/\/schema.org\/","@type":"Person","name":"GreenPopsicle"},"reviewBody":"I usually do egg flour egg bread crum but this works well also","reviewRating":{"@context":"http:\/\/schema.org\/","@type":"Rating","ratingValue":"4","worstRating":"1","bestRating":"5"}},{"@context":"http:\/\/schema.org\/","@type":"Review","datePublished":"2019-08-23","author":{"@context":"http:\/\/schema.org\/","@type":"Person","name":"OrangeBus"},"reviewBody":"It says 400\uff9f for 10 minutes","reviewRating":{"@context":"http:\/\/schema.org\/","@type":"Rating","ratingValue":"5","worstRating":"1","bestRating":"5"}}],"recipeCategory":"Snacks","recipeYield":3,"description":"Enjoy this no-guilt treat by Delish.com anytime","keywords":"snack,pickles,pickle chips,fried pickles,air-fried pickles,breaded pickles,best air-fryer recipe,best pickle chips","id":"450","dateCreated":"0","printImage":"false","imageUrl":"\/apps\/cookbook\/recipes\/450\/image?size=full","tool":[],"nutrition":[]} -------------------------------------------------------------------------------- /ExampleRecipes/Gâteau Invisible (Invisible Apple Cake)/recipe.json: -------------------------------------------------------------------------------- 1 | {"@context":"http:\/\/schema.org","@type":"Recipe","name":"G\u00e2teau Invisible (Invisible Apple Cake)","datePublished":"2020-11-18T13:00:01","dateModified":"1607562728","description":"This French dessert gets its name from the way its layers of thinly sliced apple seem to disappear into the light batter that binds them. In a nod to the popularity of gateau invisible in Japan, this version is subtly flavored with salty-sweet white miso, and served with a miso caramel sauce.\n\nWhite (shiro) miso works best with this recipe; darker misos such as red miso, awase miso, or barley miso will yield a more savory cake, and could yield a darker caramel sauce.\n\nI tested this recipe with Fuji apples, Pink Lady apples, Lady Alice apples, Granny Smith apples, and Golden Delicious apples; I prefer Fuji, Pink Lady, or Lady Alice, but different apples may produce slightly different textures and flavors. When assembling the cake, you can quickly pour in all of the apples and batter, but the resulting cake will not be as uniform in appearance. Because of variation in the shape of the apples, the amount of apples that will fit into the pan may vary. When purchasing apples, buy a few extra in order to fill the pan if necessary. You can slice the apples from anywhere between 1\/16 of an inch up to 1\/8 of an inch; the thinner you slice the apples, the more layers you will get in the cake and the more cohesive the baked cake will be, though you have to weigh that against the more tedious layering process of thinner slices.","image":"https:\/\/www.seriouseats.com\/2020\/11\/20201115-gateau-invisible-apple-cake-tim-chin-hero-1.jpg","aggregateRating":{"@type":"AggregateRating","ratingValue":"4.3076923076923","ratingCount":"13"},"recipeCuisine":"French","recipeCategory":"Dessert","recipeYield":1,"totalTime":"PT4H30M","recipeIngredient":["For the Cake:","Vegetable oil or cooking spray, for greasing the pan","1 cup all-purpose flour (5 ounces), plus more for dusting the pan","1 teaspoon (5g) baking powder","3 tablespoons (54g) white miso (see note)","2 tablespoons unsalted butter, melted","1\/2 cup whole milk (120ml)","3 large eggs","2\/3 cup (4 3\/4 ounces; 133g) sugar ","2 1\/2 pounds (1.1kg) apples, such as Fuji or Pink Lady, peeled, cored, and cut into 1\/16- to 1\/8-inch thick slices (see note) ","For the Caramel Sauce:","1\/4 cup (60ml) water","1\/2 cup plus 2 tablespoons (4 1\/4 ounces; 120g) sugar","3\/4 cup (180ml) heavy cream","2 tablespoons (36g) white miso"],"recipeInstructions":["For the Cake: Grease an 8 1\/2- by 4 1\/2-inch loaf pan and line with a 8- by 13-inch sheet of parchment paper so that parchment hangs over the long sides of the pan, forming a sling. ","Grease exposed sides of parchment paper, then dust with flour, making sure to lightly coat bottom and sides; carefully tap out excess flour. Adjust oven rack to middle position and preheat to 375\u00b0F (190\u00b0C).","In a small bowl, whisk flour and baking powder until well combined, at least 30 seconds; set bowl aside.","In a medium bowl, whisk miso and butter until miso is broken up. Whisk in roughly 2 tablespoons of milk until mixture is smooth and no lumps remain, about 30 seconds. Whisk in remaining milk until smooth; set aside.","In the bowl of a stand mixer fitted with a whisk attachment, whisk eggs and sugar at medium speed until pale and glossy, 60 to 90 seconds. (Alternatively, beat eggs and sugar in a large mixing bowl using an electric handheld mixer or a whisk, about 90 seconds for the electric mixer and 2 minutes for the whisk.)","Whisk in half of flour mixture until just combined. Whisk in milk mixture, followed by remaining flour mixture, until no lumps remain.","Using a large rubber spatula or wooden spoon, stir apples into batter until evenly coated. ","Using clean hands, arrange apple slices in prepared loaf pan in an overlapping pattern, making sure that flat sides of the apples are flush with the edges of pan (as you work, reserve some of the largest, nicest apple slices for the top layer; you'll need roughly 40 to 50 slices for it). Continue arranging apples in even layers until apples are 1\/2 inch from top; press apples down to evenly distribute.","Arrange final layer of apples in horizontal, shingled pattern. ","Scrape remaining batter into pan, making sure to leave 1\/4 inch space from top; gently tap pan to knock out air pockets and distribute batter.","Set loaf pan on middle rack of oven and slide a rimmed baking sheet on the rack underneath to catch any drips. Bake until top is golden brown and domed and a cake tested inserted into the center meets little resistance and comes out clean, 65 to 75 minutes; rotate pan one time halfway through baking. Transfer cake to wire rack and cool for 10 minutes; loosen sides with butter knife or offset spatula. Cool cake in pan to about 140\u00b0F (60\u00b0C), about 2 hours. Then lift loaf using overhanging parchment and transfer to a cutting board. Let cake cool completely before slicing, about 1 hour longer.","Meanwhile, for the Caramel: In a 3-quart stainless steel saucier, combine water and sugar over medium heat. Stir with a fork until syrup comes to a boil, about 4 minutes, then simmer without stirring until syrup is honey-colored, roughly 5 minutes, shaking and swirling as needed to ensure even caramelization. Continue cooking until syrup is light to medium amber, about 1 minute longer.","Immediately add cream and reduce heat to medium-low.","Stirring constantly with a heat-resistant spatula to knock back the foam, simmer until caramel registers 225\u00b0F (107\u00b0C) on a digital thermometer, about 3 minutes.","Off heat, whisk in miso until smooth and combined. Transfer sauce to a heat-safe container.","To serve, using a serrated knife, cut cake into 1-inch thick slices and serve with warm or room temperature caramel.","The cake can be stored, covered, at room temperature for up to 1 day. The caramel can be refrigerated in an airtight container for up to 7 days; gently rewarm to a pourable consistency before using."],"author":{"@type":"Person","name":"Tim Chin","jobTitle":"Contributor","description":"Tim Chin is a professional cook and sometimes writer. He cooked for years at restaurants in New York and Boston, working at Rouge Tomate, Northern Spy, and most recently, BiSq. He also spent three years at America\u2019s Test Kitchen, creating and testing recipes. He is passionate about sourdough, funky hot sauce, and sustainable agriculture. Outside of cooking, Tim spends most of his free time rock climbing and trying not to kill his house plants.","url":"https:\/\/www.seriouseats.com\/user\/profile\/tim-chin"},"keywords":"","tool":[" 8 1\/2- by 4 1\/2-inch loaf pan"],"url":"https:\/\/www.seriouseats.com\/recipes\/2020\/11\/gateau-invisible.html","id":"1547","dateCreated":"0","printImage":"false","imageUrl":"\/apps\/cookbook\/recipes\/1547\/image?size=full"} -------------------------------------------------------------------------------- /ExampleRecipes/A Very Popular BBQ Sauce/recipe.json: -------------------------------------------------------------------------------- 1 | {"@context":"http:\/\/schema.org","@type":"Recipe","mainEntityOfPage":"https:\/\/www.allrecipes.com\/recipe\/51226\/a-very-popular-bbq-sauce\/","name":"A Very Popular BBQ Sauce","image":"https:\/\/imagesvc.meredithcorp.io\/v3\/mm\/image?url=https%3A%2F%2Fimages.media-allrecipes.com%2Fuserphotos%2F72682.jpg","datePublished":"2020-03-05T04:57:59.000Z","description":"This recipe has a lot of sweetness and spice, so if you're looking for a classic BBQ sauce that's easy to make, look no further. It is very popular with users of 'ceramic' type smokers and grills, (i.e. Primo, Kamado, Big Green Egg, etc.)","prepTime":"PT0H10M","cookTime":"PT0H0M","totalTime":"PT0H10M","recipeYield":4,"recipeIngredient":["1\u2009\u00bd cups brown sugar","1\u2009\u00bd cups ketchup","\u00bd cup red wine vinegar","\u00bd cup water","1 tablespoon Worcestershire sauce","2\u2009\u00bd tablespoons dry mustard","2 teaspoons paprika","2 teaspoons salt","1\u2009\u00bd teaspoons black pepper","2 dashes hot pepper sauce"],"recipeInstructions":["Combine brown sugar, ketchup, vinegar, water and Worcestershire sauce in a saucepan. Season with mustard, paprika, salt, pepper, and hot pepper sauce. \nBoil until thickened.\n"],"recipeCategory":"Sauces","author":[{"@type":"Person","name":"JRNEUMILLER"}],"aggregateRating":{"@type":"AggregateRating","ratingValue":"4.561314791403287","ratingCount":"791","itemReviewed":"A Very Popular BBQ Sauce","bestRating":"5","worstRating":"1"},"nutrition":{"@type":"NutritionInformation","calories":"42.7 calories","carbohydrateContent":"10.2 g","cholesterolContent":"","fatContent":"0.3 g","fiberContent":"0.1 g","proteinContent":"0.4 g","saturatedFatContent":"","servingSize":"","sodiumContent":"278.4 mg","sugarContent":"","transFatContent":"","unsaturatedFatContent":""},"review":[{"@type":"Review","datePublished":"2007-02-21T22:08:01.393Z","reviewBody":"Boil the ingredients. The instructions don't say anything about cooking the sauce, but it is much, much better after its been cooked. As is, it was very gel-like, but cooked, you get a very flavorful sauce.","reviewRating":{"@type":"Rating","worstRating":"1","bestRating":"5","ratingValue":"4"},"author":{"@type":"Person","name":"JENIFER13","image":"","sameAs":"https:\/\/www.allrecipes.com\/cook\/1361204\/"}},{"@type":"Review","datePublished":"2009-03-23T21:03:35.23Z","reviewBody":"Great BBQ sauce!!! I cut the recipe in half for smoked baby back ribs. There's really no need to put this in a blender, just a bowl. I highly recommend putting this on the stove in a saucepan and letting it come to a boil for about one minute. Then take it off the stove and let it cool. This will let it thicken and allow the flavors to come through. If you like a sweeter sauce keep this recipe the same, if not cut back on the sugar. If you're like me and like a smoky BBQ sauce add 1\/2 tsp. of liquid smoke for half the recipe or 1 tsp. for the whole recipe. ","reviewRating":{"@type":"Rating","worstRating":"1","bestRating":"5","ratingValue":"5"},"author":{"@type":"Person","name":"Jillian","image":"","sameAs":"https:\/\/www.allrecipes.com\/cook\/jillian\/"}},{"@type":"Review","datePublished":"2006-03-28T13:03:01.543Z","reviewBody":"Ran out of Sweet Baby Ray's and needed something to make BBQ Country Style Ribs submitted by Glenda U. It would be foolish to ever buy the store bought kind again. You just can't compare them. This was great! Husband loved it, kids liked it....my 10 year old even put some on the side for dipping. I did exactly what the recipe stated. Also, I don't really think it had a \"kick\" it was sweet and tangy. This is my BBQ sauce for now on. Thanks for sharing.","reviewRating":{"@type":"Rating","worstRating":"1","bestRating":"5","ratingValue":"5"},"author":{"@type":"Person","name":"DMB4LIFE","image":"","sameAs":"https:\/\/www.allrecipes.com\/cook\/1207856\/"}},{"@type":"Review","datePublished":"2006-12-12T02:55:26.1Z","reviewBody":"wow this is an extradonary sauce. its great the way it is but if you add my modifications, you will have the greatest bbq suace you have ever had. instead of 1 tbl worcestershire sauce use 1\/2 cup. add 2 cloves of garlic (minced). delete pepper sauce and use 1 teaspoon of ground cayanne pepper.if this isnt the greatest sauce you have ever had let me know.","reviewRating":{"@type":"Rating","worstRating":"1","bestRating":"5","ratingValue":"5"},"author":{"@type":"Person","name":"jereamy","image":"","sameAs":"https:\/\/www.allrecipes.com\/cook\/2045535\/"}},{"@type":"Review","datePublished":"2006-05-08T19:28:30.14Z","reviewBody":"WOW - this is one killer recipe! I think it's unfair for cooks to make half a dozen changes and then rate so I prepared exactly as written and yum yum yum! Some of the best spareribs I've ever prepared. Note - I did you use Chipolte Tabasco for the hot sauce because it was all I had on hand.","reviewRating":{"@type":"Rating","worstRating":"1","bestRating":"5","ratingValue":"5"},"author":{"@type":"Person","name":"Kathy Williams Diaz","image":"","sameAs":"https:\/\/www.allrecipes.com\/cook\/639928\/"}},{"@type":"Review","datePublished":"2006-02-19T23:51:32.75Z","reviewBody":"I needed a quick bbq sauce fix to marinate, then cook 1.5 lbs of boneless pork ribs in the oven for tomorrow. I chose this one because I had all the ingredients and it sounded good. I scaled it to yield 8 - just the right amount for this meal. I wish I had made more. I followed each measurement exactly and love the result, especially for this. A perfect taste\/texture for an overnight marinade and cooking. Thanks. It's a keeper for sure.","reviewRating":{"@type":"Rating","worstRating":"1","bestRating":"5","ratingValue":"5"},"author":{"@type":"Person","name":"claudygirl","image":"","sameAs":"https:\/\/www.allrecipes.com\/cook\/494115\/"}},{"@type":"Review","datePublished":"2005-04-02T19:44:54.81Z","reviewBody":"This is the BEST BBQ sauce ever! Found this recipe one day when out of bottled sauce, and it was fantastic! I will never buy bottled BBQ sauce again, my family won't let me! I find using a hand mixer is better than the blender, not quite as messy. We now double the recipe when making as it goes so fast in our home. Great on beef, chicken, pork, you name it. We also warm it with a little beer to give it a different flavor. My picky 10 year old loves it too! Try it, you won't regret it!","reviewRating":{"@type":"Rating","worstRating":"1","bestRating":"5","ratingValue":"5"},"author":{"@type":"Person","name":"LADYKC67","image":"","sameAs":"https:\/\/www.allrecipes.com\/cook\/1391049\/"}},{"@type":"Review","datePublished":"2011-05-27T13:34:52.38Z","reviewBody":"Great sauce! I have made this several times now and I feel I have it perfected at least in my mind. I used only 1 cup brown sugar, 1 1\/2 cups ketchup, 1\/4 cup balsamic and 1\/4 cup red wine vinegars, 1\/2 cup beer, 2 1\/2 tablespoons dry mustard, 2 tablespoons Worcestershire sauce, 2 teaspoons sweet Hungarian paprika, 1 teaspoon each of Emerils Bayou Blast, onion powder, garlic powder, black pepper and kosher salt. After blending well I simmer it for almost an hour. This is so good on so many different things! If too spicy it can easily be adjusted but the best thing about it is, it is so much cheaper to make this sauce than it is to buy any of them from the store. Try it! You won't be dissapointed. FYI Instead of pizza sauce use this on a pineapple and ham pizza. It'll make your eyes roll back in your head!","reviewRating":{"@type":"Rating","worstRating":"1","bestRating":"5","ratingValue":"5"},"author":{"@type":"Person","name":"morenutty","image":"","sameAs":"https:\/\/www.allrecipes.com\/cook\/4656557\/"}},{"@type":"Review","datePublished":"2005-05-25T18:48:27.247Z","reviewBody":"So at first I didn't really love it, but it was ok. I let it sit over night and the next day I tasted it and it seemed a little better. Well it definitely has grown on me, I love it. My hubby loves it too, and he is very picky about this sort of thing. I will say that it has a little more of a kick to it then I prefer so next time I will use a little less of the dry mustard. No more ketchup for me anymore, I put this stuff on EVERYTHING!!","reviewRating":{"@type":"Rating","worstRating":"1","bestRating":"5","ratingValue":"5"},"author":{"@type":"Person","name":"ChefAndy","image":"","sameAs":"https:\/\/www.allrecipes.com\/cook\/1427271\/"}},{"@type":"Review","datePublished":"2011-01-31T21:01:48.990Z","reviewBody":"Wow!! Way too much red wine vinegar....makes me want to go the other way and finde a recipe without any vinegar at all. If you love vinegar, this ones for you. I didn't care for it at all,","reviewRating":{"@type":"Rating","worstRating":"1","bestRating":"5","ratingValue":"1"},"author":{"@type":"Person","name":"Macy","image":"","sameAs":"https:\/\/www.allrecipes.com\/cook\/1438014\/"}}],"video":{"@context":"http:\/\/schema.org","@type":"VideoObject","name":"A Very Popular BBQ Sauce","description":"This homemade BBQ sauce is a little bit sweet, a little bit spicy, and a whole lot delicious.","uploadDate":"2015-08-05T16:44:06.302Z","duration":"PT1M6.233S","thumbnailUrl":"https:\/\/imagesvc.meredithcorp.io\/v3\/mm\/image?url=https%3A%2F%2Fcf-images.us-east-1.prod.boltdns.net%2Fv1%2Fstatic%2F1033249144001%2Fa2c595cc-1e80-41f3-8370-8a8893777715%2Fbe51cbb9-d6dc-40b9-a59f-ccc187a8a740%2F160x90%2Fmatch%2Fimage.jpg","publisher":{"@type":"Organization","name":"Allrecipes","url":"https:\/\/www.allrecipes.com","logo":{"@type":"ImageObject","url":"https:\/\/www.allrecipes.com\/img\/logo.png","width":"209","height":"60"},"sameAs":["https:\/\/www.facebook.com\/allrecipes","https:\/\/twitter.com\/Allrecipes","https:\/\/www.pinterest.com\/allrecipes\/","https:\/\/www.instagram.com\/allrecipes\/"]},"embedUrl":"https:\/\/players.brightcove.net\/1033249144001\/default_default\/index.html?videoId=4400869159001"},"keywords":"","url":"https:\/\/www.allrecipes.com\/recipe\/51226\/a-very-popular-bbq-sauce\/","id":"1908","dateCreated":"0","dateModified":"1608602445","printImage":"false","imageUrl":"\/apps\/cookbook\/recipes\/1908\/image?size=full","tool":[]} -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # RecipeBook 2 | Python web-app (Flask) to browse [Nextcloud Cookbook](https://apps.nextcloud.com/apps/cookbook) recipes on the local network. Designed for use with E-Ink screens. 3 | 4 | For a version that works with [Tandoor](https://docs.tandoor.dev/), please navigate to [RecipeBook-Tandoor](https://github.com/NBPub/RecipeBook-Tandoor) 5 | 6 | [Deploy with Docker](#application-setup) • [Local Build](#build-locally) • [Screenshots](#screenshots) • [Version History](#history) 7 | 8 | ## Overview 9 | 10 | I created this to access recipes from [Nextcloud Cookbook](https://apps.nextcloud.com/apps/cookbook) and easily view them on Kindle's web browser whilst cooking. The view is designed for such screens, and is not as nice as the actual app. Therefore, accessing your Nextcloud website with a mobile device or tablet would just as effectively provide kitchen access to Cookbook. 11 | 12 | Please note that the web application is very basic and should not be run on untrusted networks. It is not designed to be exposed publicly. 13 | 14 | The machine running the app should have access to the Nextcloud user data (directly or via network share). 15 | The recipe data is supplied to the RecipeBook container by [volume binding](https://docs.docker.com/storage/bind-mounts/) the folder. 16 | See [LinuxServer.io](https://docs.linuxserver.io/) and [Docker](https://docs.docker.com/) for more information on Docker containers. 17 | 18 | This is my first project using Flask and building Docker containers. Feedback is appreciated. 19 | 20 | 21 | ## Application Setup 22 | 23 | Install and run using docker, examples provided below. 24 | 25 | Access main page at `:5000`. See below for changing port number. 26 | 27 | 28 | ### Usage 29 | 30 | This container is designed to run on the same machine hosting Nextcloud data. The volume binding below is for the directory containing the recipes stored by Nextcloud Cookbook. 31 | Alternatively, the data can be copied to another location, and then that location can be bound to `/code/recipe_data` 32 | 33 | If using the [LSIO NextCloud docker container](https://github.com/linuxserver/docker-nextcloud#usage), the folder may be in the following location: 34 | ``` 35 | //files/Recipes 36 | ``` 37 | Example configurations to build container are shown below. Environmental Variables are listed with default values and do not need to be specified. Healthcheck is optional. 38 | 39 | ### docker-compose 40 | 41 | ```yaml 42 | --- 43 | version: "2" 44 | services: 45 | recipe: 46 | image: nbpub/recipelook:latest 47 | container_name: recipebook 48 | volumes: 49 | - :/code/recipe_data 50 | ports: 51 | - 5000:5000 52 | environment: 53 | - TZ=America/Los_Angeles 54 | - PAGE_TITLE=Recipe Book 55 | - IMAGE_SIZE=Full 56 | - FONT_SMALL=30 57 | - FONT_LARGE=36 58 | - ENABLE_API=False 59 | healthcheck: 60 | test: wget --no-verbose --tries=1 --spider http://localhost:5000 || exit 1 61 | interval: 300s 62 | timeout: 10s 63 | start_period: 5s 64 | restart: unless-stopped 65 | ``` 66 | 67 | ### docker cli ([click here for more info](https://docs.docker.com/engine/reference/commandline/cli/)) 68 | 69 | ```bash 70 | docker run -d \ 71 | --name=recipebook \ 72 | -e TZ=America/Los_Angeles \ 73 | -e PAGE_TITLE=Recipe Book \ 74 | -e IMAGE_SIZE=Full \ 75 | -e FONT_SMALL=30 \ 76 | -e FONT_LARGE=36 \ 77 | -e ENABLE_API=False \ 78 | -p 5000:5000 \ 79 | -v :/code/recipe_data \ 80 | --health-cmd wget --no-verbose --tries=1 --spider http://localhost/ || exit 1 \ 81 | --health-interval 300s \ 82 | --health-timeout 10s \ 83 | --health-start-period 5s \ 84 | --restart unless-stopped \ 85 | nbpub/recipelook:latest 86 | ``` 87 | 88 | ### Parameters 89 | 90 | Container images are configured using parameters passed at runtime (such as those above). These parameters are separated by a colon and indicate `:` respectively. 91 | For example, `-p 5001:5000` would expose port `5000` from inside the container to be accessible from the host's IP on port `5001` outside the container. 92 | 93 | | Parameter | Function | 94 | | :----: | --- | 95 | | `-p 5000:5000` | Default Flask port. Internal port should not be changed. | 96 | | `-e TZ=America/Los_Angeles` | Set timezone for logging using tzdata. | 97 | | `-e PAGE_TITLE=Recipe Book` | Home page title. Displays on tab. | 98 | | `-e IMAGE_SIZE=Full` | Default image size to load. Can be changed to `Thumbnails`. Recipe pages have a toggle button to switch between sizes. | 99 | | `-e FONT_SMALL=30` | Default size for "small" sections: **Description** and **Reviews**. Can be changed to any `` to adjust web-page display. | 100 | | `-e FONT_LARGE=36` | Default size for "large" sections: **Ingredients** and **Instructions**. Can be changed to any `` to adjust web-page display. | 101 | | `-e ENABLE_API=False` | Set to `True` to add an endpoint at `:5000/api/info` to return system statistics (temperature, load, CPU and RAM usage) as JSON. | 102 | | `-v /code/recipe_data` | Recipes in this folder are read and displayed on the homepage. A refresh button is provided to re-parse recipes in the volume. Set to **Read-only** with ":ro" | 103 | 104 | ### Supported Architectures 105 | 106 | Images are available for the following architectures: 107 | 108 | | Architecture | 109 | | :----: | 110 | | x86-64 | 111 | | arm64 | 112 | | armhf | 113 | 114 | Pulling from DockerHub should provide the correct image for your system. 115 | The application is built on the Python-alpine base image. Debian images are available by adding `debian-` before a tag. 116 | 117 | | Tags | Description | 118 | | :----: | --- | 119 | | *latest* | Images built with each commit | 120 | | *v1.0*, *v1.1* | Stable releases, see [history](#history) below. | 121 | | *tandoor* | Tandoor compatible `v1.0` image, *no Debian image* | 122 | 123 | See [DockerHub Repository](https://hub.docker.com/r/nbpub/recipelook) 124 | 125 | 126 | ## History 127 | 128 | **Version 1.0** | *[docker](https://hub.docker.com/layers/nbpub/recipelook/v1.0/images/sha256-56ba4a2077383e6c516ece5456e52320434d4706faea41566119f27626358a1d): `v1.0`* 129 | * Initial release (16 Nov 2021) 130 | * mount recipes in `/recipe_data` not `/code/recipe_data` 131 | 132 | **Tandoor Compatability** *[docker](https://hub.docker.com/layers/nbpub/recipelook/tandoor/images/sha256-9e7abf1acdbce7667456bb74cbef2727cf4f61209af97a011541effe16076471): `tandoor`* 133 | * This version works differently, so I made a new [repository](https://github.com/NBPub/RecipeBook-Tandoor) 134 | * Github and Docker images will not updated past **Version 1.0** 135 | 136 | ---- 137 | 138 | ### Current Version 139 | 140 | **Version 1.1** *[docker](https://hub.docker.com/layers/nbpub/recipelook/v1.1/images/sha256-16bff622f682df252a185569fccc597e064012c398c23485703ff0df2cc66803): `v1.1`, `latest`* 141 | * update Python, Flask (March 2023) 142 | * add API call for system info 143 | * adds [psutil](https://github.com/giampaolo/psutil#summary) as dependency 144 | * restructured code 145 | * using "application factory" design in flask, moved initial loading + checks to `__init__.py` 146 | * added error page for No Recipe Data, rest of application will not load 147 | * JSON API is separate blueprint and file 148 | * change mount point for recipe data, added checks and logging for data path 149 | * building docker images via Github workflows 150 | * multi-stage builds with Python **slim-bullseye** and **alpine** base images 151 | * wget instead of curl for healthchecks - no need to install curl on alpine image 152 | 153 | ---- 154 | 155 | ***Version 1.2???*** 156 | 157 | * **Code** 158 | * Add tests 159 | * clean up CSS styling 160 | * Cache cleaning - delete recipe images from static 161 | * **Deployment** 162 | * Volume binding for configuration folder, let user poke through directories 163 | * Allow recipe_data folder be specified by environmental variable, instead of hard-coded in app 164 | * Use non-root user in dockerfile, allow using non-root user for container (root required to make directory) 165 | 166 | ---- 167 | 168 | ## Screenshots 169 | 170 |
171 | Home Page, lists all recipes 172 | 173 | ![Home](/Screenshots_Kindle/homepage.png "Home Page") 174 |
175 | 176 |
177 | Filter Button 178 | 179 | ![Home](/Screenshots_Kindle/category_filter.png "Filter Button") 180 |
181 | 182 |
183 | Text Search, recipe titles only 184 | 185 | ![Home](/Screenshots_Kindle/searchbar.png "Search Bar") 186 |
187 | 188 |
189 | Recipe Page example, full-sized image 190 | 191 | ![Home](/Screenshots_Kindle/ex_full.png "Big Image") 192 |
193 | 194 | 195 |
196 | Recipe Page example, thumb-sized image, Ingredients 197 | 198 | ![Home](/Screenshots_Kindle/ex_thumb.png "Small Image") 199 |
200 | 201 | 202 |
203 | Recipe Page example, continued . . . Instructions 204 | 205 | ![Home](/Screenshots_Kindle/instructions.png "Instructions") 206 |
207 | 208 | 209 |
210 | Recipe Page example, continued . . . Reviews 211 | 212 | ![Home](/Screenshots_Kindle/reviews.png "Reviews") 213 |
214 | 215 | 216 | 217 | ## Build Locally 218 | 219 | *Instructions may not be comprehensive. Docker deployment is recommended.* 220 | 221 | If you want to run RecipeBook without Docker, a python virtual environment is recommended. 222 | See [Flask Installation](https://flask.palletsprojects.com/en/2.0.x/installation/) for more details. 223 | [Python 3.9](https://wiki.python.org/moin/BeginnersGuide/Download) or newer is recommended. 224 | 225 | 1. [Download](https://github.com/NBPub/RecipeBook/archive/refs/heads/main.zip) the code in the repository. Click the green code button at the top of the page for options. 226 | 227 | 2. Extract the folder contents. Copy the files+folders within "app" directory and "requirements.txt" to a new directory `newdirectory`. 228 | Rename "ExampleRecipes" to "recipe_data" if you want to test with example data. All other contents can be deleted. 229 | 230 | 3. Copy your recipe data folder to "recipe_data" within newly made directory: `newdirectory/recipe_data` OR see **Step 7** 231 | 232 | 4. Create and activate **venv** within new directory. 233 | 234 | ``` 235 | $ cd newdirectory 236 | $ python -m venv venv 237 | $ . venv/bin/activate 238 | ``` 239 | 240 | 5. Install Flask, dependencies. *psutil* should be removed from [requirements.txt](/requirements.txt) 241 | 242 | ``` 243 | $ pip install -r requirements.txt 244 | ``` 245 | 246 | 247 | 6. *Optional* Modify the path to recipe data. See line 18 of [__init__.py](https://github.com/NBPub/RecipeBook/blob/main/app/__init__.py#L18). 248 | If you are using the ExampleRecipe folder, specify its location. 249 | Using a raw text string may be beneficial, but shouldn't be required. `path = r'path/to/ExampleRecipes'` 250 | - Modify local variables that are typically specified by environmental variables. See lines 6-15 of the same file. 251 | - `getenv("", ""`. 252 | - Enable the API by setting [line 40](https://github.com/NBPub/RecipeBook/blob/main/app/__init__.py#L40) to `True`. Ensure [psutil](https://github.com/giampaolo/psutil#summary) is installed. 253 | 254 | 7. Run! Open site in web browser http://localhost:5000 . Adjust Flask parameters as desired, see [Flask Quickstart](https://flask.palletsprojects.com/en/2.2.x/quickstart/). 255 | 256 | ``` 257 | $ flask --debug run 258 | ``` 259 | 260 | 8. Press Ctrl+C to stop server. Deactivate **venv** when finished. 261 | 262 | ``` 263 | $ deactivate 264 | ``` 265 | 266 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | --------------------------------------------------------------------------------