about summary refs log tree commit diff
path: root/packages
diff options
context:
space:
mode:
authorFranck Cuny <franck@fcuny.net>2024-05-04 13:27:23 -0700
committerFranck Cuny <franck@fcuny.net>2024-05-04 13:28:46 -0700
commit4a86b5122c3c1bfcf442a59287da809248406526 (patch)
tree4ab5ec2af31159284c36765a54981fd2ceb28991 /packages
parentadd a comment to set environment variables (diff)
downloadworld-4a86b5122c3c1bfcf442a59287da809248406526.tar.gz
start the conversion to python
Add support to move all the tools to python and organize them in a way
that should be simple.

I'm using https://rye-up.com for this.
Diffstat (limited to 'packages')
-rwxr-xr-xpackages/pizza/pizza.py58
1 files changed, 0 insertions, 58 deletions
diff --git a/packages/pizza/pizza.py b/packages/pizza/pizza.py
deleted file mode 100755
index 727d2af..0000000
--- a/packages/pizza/pizza.py
+++ /dev/null
@@ -1,58 +0,0 @@
-#!/usr/bin/env python3
-
-from bs4 import BeautifulSoup
-import requests
-from prettytable import PrettyTable
-from textwrap import fill
-from termcolor import colored
-
-
-url = "https://cheeseboardcollective.coop/pizza/"
-
-content = requests.get(url)
-soup = BeautifulSoup(content.text, "html.parser")
-
-magic_ingredients = ["corn"]
-
-table = PrettyTable()
-table.field_names = ["date", "pizza"]
-table.align = "l"
-
-pizzas = soup.select(".pizza-list > article")
-for pizza in pizzas:
-    date_color = "white"
-    menu_color = "white"
-
-    date = pizza.find(class_="date").text
-
-    # the pizza is the 1st element, the 2nd is the salad, and i don't
-    # care about the salad :)
-    menu = (
-        pizza.select(".menu > p:nth-of-type(1)")[0]
-        .get_text(strip=True, separator="\n")
-        .split("\n")
-    )
-
-    if "closed" in menu[0]:
-        date_color = "red"
-
-    if "Parbake pizza is available" in menu[0]:
-        menu.pop(0)
-
-    if "Lunch from" in menu[0]:
-        menu.pop(0)
-
-    if "No hot pizza today" in menu[0]:
-        menu.pop(0)
-
-    final_menu = "".join(menu)
-
-    for ingredient in magic_ingredients:
-        if ingredient in final_menu:
-            menu_color = "yellow"
-
-    table.add_row(
-        [colored(date, date_color), fill(colored(final_menu, menu_color), width=80)]
-    )
-
-print(table)