diff --git a/common.py b/common.py index 5104603..74082e8 100644 --- a/common.py +++ b/common.py @@ -8,9 +8,9 @@ def format_timestamp(timestamp): return datetime.fromtimestamp(timestamp).strftime('%Y-%m-%d %H:%M:%S') def parse_foods_file(): - path = Path.home() / 'projects' / 'open-journal' / 'foods' + path = Path.home() / 'workspace' / 'journal' / 'foods' text = path.read_text() - foods, recipes_str = text.split('---') + foods_str, recipes_str = text.split('---') def parse_macro(macro): if macro == '...': @@ -22,7 +22,7 @@ def parse_foods_file(): foods = { macros[0]: dict(parse_macro(macro) for macro in macros[1:]) - for macros in [food.split('\n') for food in foods.strip().split('\n\n')] + for macros in [food.split('\n') for food in foods_str.strip().split('\n\n')] } def combine_values(fst, snd): @@ -100,7 +100,8 @@ def evaluate_food_entry(foods, recipes, value, name): food = {k: v*(value/100.0) for k,v in foods[name].items()} else: breakpoint() - print(f'ERROR: Invalid diet entry: {content}') + print(f'ERROR: Invalid diet entry: {name}') + assert False return food diff --git a/foods b/foods deleted file mode 100644 index 0815449..0000000 --- a/foods +++ /dev/null @@ -1,1229 +0,0 @@ - -MangoIcecream -Energy 168kcal -Fat 5.8g -SaturatedFat 3.9g -Carbs 26g -Sugar 23g -Protein 2.9g -Salt 0.12g - -Popcorn -Energy 375kcal -Fat 4.3g -SaturatedFat 0.6g -Carbs 74g -Fiber 13g -Sugar 0.9g -Protein 11g - -Kompot -Energy 60kcal -Carbs 15g -Sugar 14g - -WhippedCream -Energy 252kcal -Fat 23g -SaturatedFat 18g -Carbs 9.5g -Sugar 3.2g - -GrandinoCookies -Energy 513kcal -Fat 27.2g -SaturatedFat 12.5g -Carbs 60g -Sugar 40.2g -Protein 5.4g -Salt 0.6g - -FourCheesePizza -Energy 215kcal -Fat 9.4g -SaturatedFat 5.5g -Carbs 20.7g -Sugar 3.3g -Protein 10.9g -Salt 1g - -TeriyakiSauce -Energy 150kcal -Fat 0g -Carbs 40g -Sugar 37g -Protein 3g -Salt 5.1g - -ChowMeinNoodles -Energy 364kcal -Fat 1g -SaturatedFat 0.4g -Carbs 75.6g -Sugar 1.7g -Protein 11.8g -Salt 0.43g - -MaggiBuljong -Energy 5kcal - -RedLentil -Energy 350kcal -Fat 1.8g -SaturatedFat 0.3g -Carbs 51g -Sugar 1.3g -Fiber 11g -Protein 26g -Salt 0.1g - -KauraRieskanen -Energy 161kcal -Fat 2.7g -SaturatedFat 0.5g -Carbs 25.4g -Sugar 1.9g -Fiber 6.6g -Protein 5.4g -Salt 1.6g - -Margarita -Energy 60kcal - -Mayonnaise -Energy 328kcal -Fat 30g -SaturatedFat 2.4g -Carbs 12.2g -Sugar 8.2g -Protein 0.6g -Salt 1.81g - -CannedPeas -Energy 79kcal -Fat 1.1g -SaturatedFat 0.3g -Carbs 7.3g -Sugar 2.2g -Protein 5.2g -Salt 0.46g - -Carrot -Energy 40kcal -Fat 0.2g -Carbs 9.6g -Fiber 2.8g -Sugar 4.7g -Protein 0.9g - -Cucumber -Energy 10kcal -Fat 0.2g -Carbs 2.2g -Fiber 0.7g -Sugar 1.4g -Protein 0.6g - -TatraHelbed -Energy 365kcal -Fat 2.6g -SaturatedFat 0.4g -Carbs 74g -Sugar 1.2g -Fiber 4.5g -Protein 9.6g - -SoySauce -Energy 77kcal -Carbs 3.2g -Sugar 0.6g -Protein 10g -Salt 16.9g - -Pear -Energy 57kcal -Fat 0.1g -Carbs 15g -Fiber 3.1g -Sugar 10g -Protein 0.4g - -AlmondMilk -Energy 26kcal -Fat 1.3g -SaturatedFat 0.1g -Carbs 3.1g -Protein 0.5g -Salt 0.13g - -NyhtoKaura -Energy 213kcal -Fat 5.9g -SaturatedFat 0.8g -Carbs 10g -Sugar 3.4g -Fiber 3g -Protein 28g -Salt 1.5g - -HamburgerSauce -Energy 333kcal -Fat 31.2g -SaturatedFat 2.4g -Carbs 10g -Carbs 7.2g -Protein 1.8g -Salt 1.24g - -AmericanCheese -Energy 247kcal -Fat 17g -SaturatedFat 11g -Carbs 6.5g -Sugar 6.5g -Protein 17g -Salt 3.25g - -Cheese -Energy 329kcal -Fat 24g -SaturatedFat 14g -Protein 27g -Salt 1.5g - -HalloumiCheese -Energy 319kcal -Fat 25g -SaturatedFat 16g -Carbs 1.5g -Protein 22.0g -Salt 2.7g - -HamburgerBread -Energy 284kcal -Fat 5.9g -SaturatedFat 0.6g -Carbs 46.3g -Sugar 6.9g -Fiber 3.4g -Protein 10.6g -Salt 1.2g - -Tomato -Energy 18kcal -Fat 0.2g -Carbs 3.9g -Fiber 1.2g -Sugar 2.6g -Protein 0.9g - -Pepsi -Energy 41kcal -Carbs 11g -Sugar 11g - -KauraPasta -Energy 359kcal -Fat 3.5g -SaturatedFat 0.7g -Carbs 65g -Sugar 2.9g -Fiber 6g -Protein 13g - -Kaurakeksi -Energy 461kcal -Fat 20g -SaturatedFat 8.5g -Carbs 56g -Sugar 31g -Fiber 4.8g -Protein 7.9g -Salt 0.2g - -Cereal -Energy 373kcal -Fat 1.4g -SaturatedFat 0.4g -Carbs 78g -Sugar 13.9g -Fiber 7.1g -Protein 8.5g -Salt 0.39g - -SadonkorjuuPuuro -Energy 385kcal -Fat 11g -SaturatedFat 1.7g -Carbs 51g -Sugar 1.1g -Fiber 11g -Protein 14g - -DaimCake -Energy 446kcal -Fat 28g -SaturatedFat 9.3g -Carbs 39g -Sugar 37g -Protein 9.1g -Salt 0.35g - -KaneliKierre -Energy 350kcal -Fat 14g -SaturatedFat 5.6g -Carbs 55g -Sugar 20g -Fiber 2g -Protein 6g -Salt 0.7g - -Munkki -Energy 395kcal -Fat 23g -SaturatedFat 10g -Carbs 39g -Sugar 9.6g -Fiber 2.7g -Protein 5.8g -Salt 0.5g - -ProteinRakha -Energy 67kcal -Fat 0.2g -SaturatedFat 0.1g -Carbs 6g -Sugar 5.9g -Protein 10g -Salt 0.06g - -Water -Energy 0kcal - -KaneliKorppu -Energy 359kcal -Fat 6.6g -SaturatedFat 0.5g -Carbs 65g -Sugar 23g -Fiber 4g -Protein 8g -Salt 0.5g - -Broccoli -Energy 34kcal -Fat 0.4g -Carbs 7g -Fiber 2.6g -Sugar 1.7g -Protein 2.8g - -Apple -Energy 52kcal -Fat 0.2g -Carbs 14g -Fiber 2.4g -Sugar 10g -Protein 0.3g - -BeanitHarkis -Energy 206kcal -Fat 10g -SaturatedFat 1g -Carbs 9g -Sugar 0.9g -Fiber 6.1g -Protein 16g -Salt 1.3g - -HarkisRouheseos -Energy 335kcal -Fat 3.1g -SaturatedFat 0.3g -Carbs 26g -Sugar 3.7g -Fiber 12g -Protein 47g -Salt 1.0g - -HazelnutIcecream -Energy 288kcal -Fat 18g -SaturatedFat 5.6g -Carbs 27g -Sugar 24g -Fiber 1.1g -Protein 4.0g -Salt 0.17g - -CheesePizza -Energy 210kcal -Fat 5.3g -SaturatedFat 2.4g -Carbs 30.6g -Sugar 3.9g -Protein 8.9g -Salt 0.9g - -ChiliBeans -Energy 85kcal -Carbs 12g -Sugar 2.5g -Fiber 5.8g -Protein 6.0g -Salt 0.65g - -ProteinPowder -Energy 369kcal -Fat 5.4g -SaturatedFat 3.4g -Carbs 7.2g -Sugar 6.8g -Protein 72.0g -Salt 0.3g - -KasviGrillimakkara -Energy 234kcal -Fat 15.2g -SaturatedFat 5.9g -Carbs 12.1g -Fiber 4.5g -Protein 10.0g -Salt 1.55g - -Remoulade -Energy 486kcal -Fat 50.3g -SaturatedFat 4.0g -Carbs 7.0g -Sugar 5.2g -Protein 0.8g -Salt 1.04 - -ItaliamoGlassate -Energy 537kcal -Fat 32g -SaturatedFat 19g -Carbs 54g -Sugar 25g -Protein 7.3g -Salt 1g - -LeipaJuusto -Energy 276kcal -Fat 22g -SaturatedFat 14g -Carbs 3.5g -Sugar 2.8g -Protein 16g - -Pomegranate -Energy 83kcal -Carbs 19g -Fiber 4g -Sugar 14g -Protein 1.7g - -RainbowNoodles -Energy 451kcal -Fat 18g -SaturatedFat 8.6g -Carbs 63g -Sugar 1.7g -Protein 11g -Salt 4.6g - -Banana -Energy 89kcal -Carbs 22.84g -Sugar 12.23g -Fiber 2.6g -Fat 0.33g -Protein 1.09g - -Oil -Energy 828kcal -Fat 92g -SaturatedFat 7g -MonosaturatedFat 57g -PolysaturatedFat 28g - -Egg -Energy 155kcal -Carbs 1.12g -Fat 10.6g -Protein 12.6g - -Milk -Energy 64kcal -Fat 3.5g -SaturatedFat 2.3g -Protein 3.2g -Salt 0.1g - -SkimMilk -Energy 46kcal -Fat 1.5g -SaturatedFat 1.0g -Protein 3.4g -Salt 0.1g - -BellPepper -Energy 31kcal -Protein 1g -Carbs 6g -Sugar 4.2g -Fiber 2.1g -Fat 0.3g - -Flour -Energy 349kcal -Fat 1.4g -SaturatedFat 0.3g -Carbs 71.5g -Sugar 1.7g -Fiber 2.4g -Protein 11.4g -Salt 0.01g - -GrahamFlour -Energy 330kcal -Fat 3.0g -SaturatedFat 0.5g -Carbs 56g -Sugar 0.8g -Fiber 13g -Protein 14g - -Salt -Energy 0kcal -Salt 100g - -Potato -Energy 68kcal -Fat 0.2g -Carbs 13.3g -Protein 1.6g -Fiber 0.8g - -SweetPotato -Energy 86kcal -Carbs 20g -Fiber 3g -Sugar 4.2g -Protein 1.6g - -Salad -Energy 10kcal -Fat 0.2g -SaturatedFat 0g -Carbs 1g -Sugar 0.5g -Protein 1.1g - -SaladDressing -Energy 259kcal -Fat 22.3g -SaturatedFat 1.5g -Carbs 14g -Sugar 10.8g -Protein 0.4g -Salt 0.99g - -PeasCornPepper -Energy 85kcal -Fat 0.7g -SaturatedFat 0.2g -Carbs 12g -Sugar 2.4g -Fiber 5.5g -Protein 4.9g -Salt 0.07g - -Muesli -Energy 391kcal -Fat 10.9g -SaturatedFat 3.9g -Carbs 61.9g -Sugar 26.7g -Fiber 6g -Protein 8.4g -Salt 0.08g - -Margarine -Energy 630kcal -Fat 70g -SaturatedFat 20g -UnsaturatedFat 35g - -PickleSlices -Energy 54kcal -Sugar 12.1g -Salt 1g - -Ketchup -Energy 102kcal -Carbs 23.2g -Sugar 22.8g -Protein 1.2g -Salt 1.8g - -WholeGrainBread -Energy 255kcal -Fat 5g -SaturatedFat 0.5g -Carbs 41g -Sugar 4g -Fiber 7g -Protein 8g -Salt 1g - -WhiteBread -Energy 253kcal -Fat 2.5g -SaturatedFat 0.3g -Carbs 45g -Sugar 1.1g -Fiber 6.1g -Protein 9.4g -Salt 1.1g - -DarkBread -Energy 242kcal -Fat 1.3g -SaturatedFat 0.2g -Carbs 43.6g -Sugar 1.4g -Fiber 11.7g -Protein 8.2g -Salt 1.1g - -KauraTyynyt -Energy 254kcal -Fat 4.1g -SaturatedFat 0.5g -Carbs 39g -Sugar 0.8g -Fiber 6.6g -Protein 12g -Salt 1.1g - -BiscuitRings -Energy 541kcal -Fat 30.1g -SaturatedFat 14.8g -Carbs 61.8g -Sugar 23.1g -Protein 4.6g -Salt 0.48g - -SobaChili -Energy 218kcal -Fat 9.3g -SaturatedFat 4.4g -Carbs 27.4g -Sugar 6g -Protein 4.9g -Salt 2.3g - -CocaCola -Energy 42kcal -Carbs 10.6g -Sugar 10.6g - -Pasta -Energy 348kcal -Fat 1.7g -SaturatedFat 0.4g -Carbs 67g -Sugar 2.5g -Fiber 4g -Protein 13g - -TricolorePasta -Energy 351kcal -Fat 1.4g -SaturatedFat 0.3g -Carbs 72g -Sugar 3.9g -Protein 11g - -WholeGrainPasta -Energy 350kcal -Fat 2g -SaturatedFat 0.4g -Carbs 62g -Sugar 3.6g -Fiber 8g -Protein 16g - -SaskiaPeach -Energy 16kcal -Sugar 4g - -GelatelliVeganIceCream -Energy 342kcal -Fat 21.3g -SaturatedFat 16g -Carbs 34.3g -Sugar 24.2g -Protein 2.3g - -BrownRice -Energy 371kcal -Fat 2g -SaturatedFat 0.5g -Carbs 77g -Fiber 8.7g -Protein 7.1g - -SojaRouha -Energy 77kcal -Carbs 6.2g -Sugar 3.15g -Protein 12.21g -Salt 1.34g - -MonsterEnergy -Energy 47kcal -Sugar 11g - -MousseCherry -Energy 535kcal -Fat 36.4g -SaturatedFat 21.2g -Carbs 41.4g -Sugar 31.4g -Protein 6.5g - -FoodCream -Energy 161kcal -Fat 15g -SaturatedFat 10g -Carbs 4.7g -Sugar 3.7g - -Honey -Energy 305kcal -Carbs 80g -Sugar 80g - -Coffee -Energy 0kcal - -Oatmeal -Energy 362kcal -Fat 7.5g -SaturatedFat 1.3g -Carbs 54g -Sugar 1.1g -Fiber 11g -Protein 14g - -VahvlitortTallinn -Energy 505kcal -Fat 51g -Carbs 40g -Sugar 25g -Protein 6g - -TaffelJuustoSnaks -Energy 550kcal -Fat 33g -SaturatedFat 6.2g -Carbs 51g -Sugar 3.6g -Protein 10g -Salt 1.8g - -FakeChicken -Energy 142kcal -Fat 5g -SaturatedFat 0.5g -Carbs 11.3g -Sugar 1.57g -Protein 13.14g -Salt 0.39g - -SourCream -Energy 139kcal -Fat 12g -SaturatedFat 6.7g -Carbs 4g -Sugar 4g -Protein 2.8g -Salt 0.1g - -WhiteBeansTomatoSauce -Energy 105kcal -Protein 4g -Carbs 18g -Sugar 2g - -CherryTomatoes -Energy 18kcal -Carbs 3.92g -Sugar 2.62g -Fiber 1.2g -Protein 0.88g -Fat 0.2g - -BerryMustikaVaarika -Energy 85kcal -Carbs 13g -Sugar 7.2g -Fiber 4.7g -Protein 0.95g - -OrangeIcecream -Energy 197kcal -Fat 8.4g -SaturatedFat 5.6g -Carbs 27.8g -Sugar 25.6g -Protein 2.6g -Salt 0.07g - -VanilliIceCream -Energy 160kcal -Fat 6.3g -SaturatedFat 4.1g -Carbs 22.5g -Sugar 19.9g -Protein 3.2g -Salt 0.12g - -Strawberry -Energy 33kcal -Carbs 8g -Fiber 2g -Sugar 4.9g -Protein 0.7g -Fat 0.3g - -Cocoa -Energy 373kcal -Fat 2.9g -SaturatedFat 1.5g -Carbs 78.6g -Sugar 76.6g -Protein 4.8g -Salt 0.31g - -Sugar -Energy 400kcal -Carbs 100g -Sugar 100g - -KeishaCandy -Energy 553kcal -Fat 35g -SaturatedFat 18g -Carbs 47g -Sugar 45g -Protein 8.1g -Salt 0.13g - -ProteinSpaghetti -Energy 350kcal -Fat 2.5g -SaturatedFat 0.6g -Carbs 66g -Sugar 3.7g -Fiber 7.5g -Protein 12g - -PastaSauce -Energy 61kcal -Fat 1.9g -SaturatedFat 0.2g -Carbs 9.2g -Sugar 5.7g -Protein 1.3g -Salt 1.27g - -Orange -Energy 50kcal -Carbs 13g -Fiber 2.2g -Sugar 8.5g - -WokMix -Energy 36kcal -Carbs 5.5g -Sugar 3.9g -Fiber 2.7g -Protein 1.7g -Salt 0.04g - -ProteinRahka -Energy 67kcal -Fat 0.2g -SaturatedFat 0.1g -Carbs 6.0g -Sugar 5.9g -Protein 10g -Salt 0.06g - -Watermelon -Energy 30kcal -Carbs 8g -Sugar 6g -Fiber 0.4g -Protein 0.6g - -Pringles -Energy 536kcal -Fat 32g -SaturatedFat 3g -Carbs 56g -Sugar 2.4g -Fiber 2.9g -Protein 4.6g -Salt 1.4g - -GelatiPremium -Energy 339kcal -Fat 21.3g -SaturatedFat 13.1g -Carbs 30.7g -Sugar 28.5g -Protein 5.4g -Salt 0.08g - -Hummus -Energy 278kcal -Fat 23.8g -SaturatedFat 2.7g -Carbs 7.7g -Sugar 0.2g -Protein 6.8g -Salt 0.92g - -PureOrangeJuice -Energy 45kcal -Fat 0.2g -Carbs 9.4g -Sugar 9.4g -Protein 0.08g - -Cucumber -Energy 15kcal -Carbs 3.6g -Sugar 1.7g -Fiber 0.5g -Protein 0.7g - -Falafel -Energy 219kcal -Fat 8.5g -SaturatedFat 0.7g -Carbs 19.9g -Sugar 4.1g -Fiber 9.9g -Protein 10.7g -Salt 1.4g - -SunflowerSeeds -Energy 616kcal -Fat 53.9g -SaturatedFat 4.5g -Carbs 5.1g -Sugar 3.4g -Protein 21.4g -Salt 0.05 - -Salmon -Energy 208kcal -Fat 13g -SaturatedFat 3.0g -Protein 20g - ---- - -Omlette -BellPepper 50g -Cheese 25g -Egg 180g -Flour 25g -Milk 80g -Oil 20g -Salt 2g - -RoastedVeggies -Oil 80g -Potato 1000g -SweetPotato 450g - -RoastedVeggies2 -Broccoli 300g -Oil 70g -Potato 1000g -SweetPotato 300g - -RoastedVeggies3 -Broccoli 180g -Potato 510g -Carrot 160g -SweetPotato 310g -Oil 120g - -OmletteWithoutMilk -Cheese 25g -Egg 180g -Flour 25g -Milk 80g -Oil 20g - -FriedPotatoes -Potato 1560g -Oil 60g - -BoiledWokMix -WokMix 400g -Oil 25g - -FakeChickenVeggies -FakeChicken 250g -Oil 40g -PeasCornPepper 225g - -OilVeggies -Oil 30g -PeasCornPepper 220g - -MashedPotato -Margarine 40g -Milk 180g -Potato 1000g -TOTAL 1300g - -MashedPotato2 -Margarine 20g -Potato 760g -Milk 300g - -MashedPotato3 -Potato 1050g -Milk 350g - -Blov -BrownRice 600g -Ketchup 250g -Oil 50g -SojaRouha 300g -PeasCornPepper 225g -TOTAL 2460g - -RiceAndVeggies -BrownRice 700g -PeasCornPepper 450g -Oil 40g -TOTAL 1960g - -MilkSoup -Margarine 30g -Milk 500g -Oil 25g -Pasta 350g -Sugar 10g -TOTAL 1315g - -MilkSoup2 -Margarine 30g -Milk 480g -Oil 20g -Sugar 15g -Pasta 350g -TOTAL 1940g - -Pancake -Egg 120g -Milk 600g -Oil 50g -Sugar 12g -Flour 300g - -Pancake2 -AlmondMilk 650g -Egg 130g -Sugar 10g -Oil 30g -Flour 370g - -CreamPotatoes -Cheese 170g -FoodCream 450g -Oil 50g -Potato 1500g - -CreamPotatoes2 -Cheese 200g -FoodCream 450g -Potato 1020g - -ProteinSpaghettiBolognese -ProteinSpaghetti 500g -PastaSauce 500g -TOTAL 1640g - -OatmealPorridge -Oatmeal 150g -Margarine 14g -Honey 25g -TOTAL 700g - -BakedPotatoes -Potato 1440g -Oil 40g - -BakedPotatoes2 -Potato 1150g -Oil 60g - -SeedAndOilSalad -Salad 120g -Cucumber 120g -CherryTomatoes 120g -Oil 15g -SunflowerSeeds 20g - -FriedFalafel -Falafel 400g -Oil 30g - -PastaSalad -TricolorePasta 500g -Salad 300g -Oil 20g -SaladDressing 65g -TOTAL 1675g - -PastaSalad2 -TricolorePasta 500g -Salad 270g -Oil 30g -SaladDressing 100g -TOTAL 1675g - -ProteinShake -SkimMilk 400g -ProteinPowder 60g - -VegeKotlet -Oil 45g -HarkisRouheseos 180g -Milk 240g -Egg 65g -GrahamFlour 60g - -VegeKotlet2 -HarkisRouheseos 200g -Milk 450g -WholeGrainBread 50g -Flour 90g - -VegeKotlet3 -HarkisRouheseos 200g -Milk 400g -Egg 195g -Flour 70g - -BeanitHarkisVeggies -Oil 60g -BeanitHarkis 250g -PeasCornPepper 200g -Ketchup 100g -TOTAL 760g - -BeanitHarkisVeggies2 -Oil 40g -BeanitHarkis 250g -PeasCornPepper 220g -Ketchup 100g -TOTAL 740g - -NyhtoKauraVeggies -Oil 40g -NyhtoKaura 240g -PeasCornPepper 220g -Ketchup 40g - -Pancake -SkimMilk 430g -Water 300g -Oil 30g -Flour 430g -Sugar 20g - -SadonkorjuuPuuroBoiled -SadonkorjuuPuuro 160g -SkimMilk 100g -Margarine 20g -TOTAL 788 - -KauraPastaVeggies -Oil 40g -KauraPasta 500g -PeasCornPepper 450g -TOTAL 1720g - -Smoothie -AlmondMilk 500g -Banana 144g -Pear 210g -Apple 90g -Sugar 10g - -TatraHelbedDone -TatraHelbed 290g -Margarine 60g -TOTAL 1440g - -PotatoSalad -Potato 1060g -PickleSlices 280g -CannedPeas 250g -Carrot 390g -Cucumber 300g -SourCream 600g -Mayonnaise 400g -Sugar 15g - -LentilSoup -RedLentil 400g -MaggiBuljong 20g -Oil 35g -Carrot 350g -Potato 400g -TOTAL 2635g - -BreadEgg -WholeGrainBread 40g -Oil 20g -Egg 130g - -PopcornDone -Popcorn 150g -Oil 40g - -MacCheeseVeggies -Cheese 150g -Oil 20g -PeasCornPepper 230g -WholeGrainPasta 400g -TOTAL 1270g - -EggMacCheeseVeggies -MacCheeseVeggies 215g -Egg 325g -Oil 20g -Flour 20g -Cheese 45g - -VegeKotlet4 -HarkisRouheseos 350g -SkimMilk 400g -Egg 260g -Flour 60g diff --git a/godword b/godword deleted file mode 100644 index 9496e14..0000000 --- a/godword +++ /dev/null @@ -1,1000 +0,0 @@ -a -ability -able -about -above -accept -according -account -across -act -action -activity -actually -add -address -administration -admit -adult -affect -after -again -against -age -agency -agent -ago -agree -agreement -ahead -air -all -allow -almost -alone -along -already -also -although -always -American -among -amount -analysis -and -animal -another -answer -any -anyone -anything -appear -apply -approach -area -argue -arm -around -arrive -art -article -artist -as -ask -assume -at -attack -attention -attorney -audience -author -authority -available -avoid -away -baby -back -bad -bag -ball -bank -bar -base -be -beat -beautiful -because -become -bed -before -begin -behavior -behind -believe -benefit -best -better -between -beyond -big -bill -billion -bit -black -blood -blue -board -body -book -born -both -box -boy -break -bring -brother -budget -build -building -business -but -buy -by -call -camera -campaign -can -cancer -candidate -capital -car -card -care -career -carry -case -catch -cause -cell -center -central -century -certain -certainly -chair -challenge -chance -change -character -charge -check -child -choice -choose -church -citizen -city -civil -claim -class -clear -clearly -close -coach -cold -collection -college -color -come -commercial -common -community -company -compare -computer -concern -condition -conference -Congress -consider -consumer -contain -continue -control -cost -could -country -couple -course -court -cover -create -crime -cultural -culture -cup -current -customer -cut -dark -data -daughter -day -dead -deal -death -debate -decade -decide -decision -deep -defense -degree -Democrat -democratic -describe -design -despite -detail -determine -develop -development -die -difference -different -difficult -dinner -direction -director -discover -discuss -discussion -disease -do -doctor -dog -door -down -draw -dream -drive -drop -drug -during -each -early -east -easy -eat -economic -economy -edge -education -effect -effort -eight -either -election -else -employee -end -energy -enjoy -enough -enter -entire -environment -environmental -especially -establish -even -evening -event -ever -every -everybody -everyone -everything -evidence -exactly -example -executive -exist -expect -experience -expert -explain -eye -face -fact -factor -fail -fall -family -far -fast -father -fear -federal -feel -feeling -few -field -fight -figure -fill -film -final -finally -financial -find -fine -finger -finish -fire -firm -first -fish -five -floor -fly -focus -follow -food -foot -for -force -foreign -forget -form -former -forward -four -free -friend -from -front -full -fund -future -game -garden -gas -general -generation -get -girl -give -glass -go -goal -good -government -great -green -ground -group -grow -growth -guess -gun -guy -hair -half -hand -hang -happen -happy -hard -have -he -head -health -hear -heart -heat -heavy -help -her -here -herself -high -him -himself -his -history -hit -hold -home -hope -hospital -hot -hotel -hour -house -how -however -huge -human -hundred -husband -I -idea -identify -if -image -imagine -impact -important -improve -in -include -including -increase -indeed -indicate -individual -industry -information -inside -instead -institution -interest -interesting -international -interview -into -investment -involve -issue -it -item -its -itself -job -join -just -keep -key -kid -kill -kind -kitchen -know -knowledge -land -language -large -last -late -later -laugh -law -lawyer -lay -lead -leader -learn -least -leave -left -leg -legal -less -let -letter -level -lie -life -light -like -likely -line -list -listen -little -live -local -long -look -lose -loss -lot -love -low -machine -magazine -main -maintain -major -majority -make -man -manage -management -manager -many -market -marriage -material -matter -may -maybe -me -mean -measure -media -medical -meet -meeting -member -memory -mention -message -method -middle -might -military -million -mind -minute -miss -mission -model -modern -moment -money -month -more -morning -most -mother -mouth -move -movement -movie -Mr -Mrs -much -music -must -my -myself -name -nation -national -natural -nature -near -nearly -necessary -need -network -never -new -news -newspaper -next -nice -night -no -none -nor -north -not -note -nothing -notice -now -n't -number -occur -of -off -offer -office -officer -official -often -oh -oil -ok -old -on -once -one -only -onto -open -operation -opportunity -option -or -order -organization -other -others -our -out -outside -over -own -owner -page -pain -painting -paper -parent -part -participant -particular -particularly -partner -party -pass -past -patient -pattern -pay -peace -people -per -perform -performance -perhaps -period -person -personal -phone -physical -pick -picture -piece -place -plan -plant -play -player -PM -point -police -policy -political -politics -poor -popular -population -position -positive -possible -power -practice -prepare -present -president -pressure -pretty -prevent -price -private -probably -problem -process -produce -product -production -professional -professor -program -project -property -protect -prove -provide -public -pull -purpose -push -put -quality -question -quickly -quite -race -radio -raise -range -rate -rather -reach -read -ready -real -reality -realize -really -reason -receive -recent -recently -recognize -record -red -reduce -reflect -region -relate -relationship -religious -remain -remember -remove -report -represent -Republican -require -research -resource -respond -response -responsibility -rest -result -return -reveal -rich -right -rise -risk -road -rock -role -room -rule -run -safe -same -save -say -scene -school -science -scientist -score -sea -season -seat -second -section -security -see -seek -seem -sell -send -senior -sense -series -serious -serve -service -set -seven -several -sex -sexual -shake -share -she -shoot -short -shot -should -shoulder -show -side -sign -significant -similar -simple -simply -since -sing -single -sister -sit -site -situation -six -size -skill -skin -small -smile -so -social -society -soldier -some -somebody -someone -something -sometimes -son -song -soon -sort -sound -source -south -southern -space -speak -special -specific -speech -spend -sport -spring -staff -stage -stand -standard -star -start -state -statement -station -stay -step -still -stock -stop -store -story -strategy -street -strong -structure -student -study -stuff -style -subject -success -successful -such -suddenly -suffer -suggest -summer -support -sure -surface -system -table -take -talk -task -tax -teach -teacher -team -technology -television -tell -ten -tend -term -test -than -thank -that -the -their -them -themselves -then -theory -there -these -they -thing -think -third -this -those -though -thought -thousand -threat -three -through -throughout -throw -thus -time -to -today -together -tonight -too -top -total -tough -toward -town -trade -traditional -training -travel -treat -treatment -tree -trial -trip -trouble -true -truth -try -turn -TV -two -type -under -understand -unit -until -up -upon -us -use -usually -value -various -very -victim -view -violence -visit -voice -vote -wait -walk -wall -want -war -watch -water -way -we -weapon -wear -week -weight -well -west -western -what -whatever -when -where -whether -which -while -white -who -whole -whom -whose -why -wide -wife -will -win -wind -window -wish -with -within -without -woman -wonder -word -work -worker -world -worry -would -write -writer -wrong -yard -yeah -year -yes -yet -you -young -your -yourself diff --git a/habits b/habits deleted file mode 100644 index fb56c5a..0000000 --- a/habits +++ /dev/null @@ -1,3 +0,0 @@ -take vitamins -weigh yourself -exercise diff --git a/open-journal.py b/open-journal.py index a4e46d0..14d0542 100644 --- a/open-journal.py +++ b/open-journal.py @@ -17,11 +17,11 @@ target_page = journal_path / f'{current_date}.md' script_path = Path(__file__).parent habits = '\n'.join([f'[-] {x}' - for x in (script_path / 'habits').read_text().strip().split('\n')]) + for x in (journal_path / 'habits').read_text().strip().split('\n')]) -words = (script_path / 'godword').read_text().strip().split('\n') +words = (journal_path / 'godword').read_text().strip().split('\n') godword = '\n'.join(' '.join(random.choice(words) - for a in range(10)) for _ in range(2)) + for __ in range(10)) for _ in range(2)) if not target_page.exists(): Popen( @@ -43,23 +43,22 @@ if not target_page.exists(): block['message'] )) - notifications_rendered = '\n'.join( - f'[[{entry}]] {message}' - for entry, message in notifications - ) + parts = [ + f'# {target_page.stem}', + f'Godword:\n{godword}', + f'Habits:\n{habits}', + ] - target_page.write_text(f'''\ -# {target_page.stem} + if notifications: + notifications_rendered = '\n'.join( + f'[[{entry}]] {message}' + for entry, message in notifications + ) -Godword: -{godword} + parts.append(f'Notifications:\n{notifications_rendered}') -Habits: -{habits} - -Notifications: -{notifications_rendered} -''') + header = '\n\n'.join(parts) + target_page.write_text(header) with open(target_page, 'a') as fp: fp.write(f'\n{current_date} {current_time} ') diff --git a/parse.py b/parse.py index 1f97273..e77c116 100644 --- a/parse.py +++ b/parse.py @@ -45,6 +45,7 @@ def parse_header(header): title, *modules = split_into_blocks(header) for module in modules: + print(module) name, value = module.split('\n', maxsplit=1) name = name.lower().removesuffix(':') result[name] = header_modules[name](value) @@ -182,5 +183,7 @@ for fpath in list(sorted((Path.home() / 'workspace' / 'journal').glob('*.md'))): 'entries': [parse_entry(e) for e in entries], } -with open('journal.json', 'w') as fp: +script_path = Path(__file__).parent + +with open(script_path / 'journal.json', 'w') as fp: json.dump(result, fp, indent=4, ensure_ascii=False)