diff --git a/LICENSE b/LICENSE index fdddb29..6f8e5e8 100644 --- a/LICENSE +++ b/LICENSE @@ -1,24 +1,21 @@ -This is free and unencumbered software released into the public domain. +MIT License -Anyone is free to copy, modify, publish, use, compile, sell, or -distribute this software, either in source code form or as a compiled -binary, for any purpose, commercial or non-commercial, and by any -means. +Copyright (c) 2022 Ziad Arafat -In jurisdictions that recognize copyright laws, the author or authors -of this software dedicate any and all copyright interest in the -software to the public domain. We make this dedication for the benefit -of the public at large and to the detriment of our heirs and -successors. We intend this dedication to be an overt act of -relinquishment in perpetuity of all present and future rights to this -software under copyright law. +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. -For more information, please refer to +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md index 80fcaca..d21d5a1 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,79 @@ # mealman -Meal manager for calorie counting. -## What is this? -This is a simple tool I wrote for myself to help keep track of my meals and calories. -Existing apps have too many features and are expensive if you want to use them practically. -This simple tool has the minimum features that I need and just helps me automate the calorie counting and meal planning process. Its especially helpful for my homemade meals where there are few calorie labels. +Meal manager for calorie counting: a small tool I wrote for myself because the existing apps were expensive and +wanted me to log more than I wanted to log. It is deliberately minimal — a CSV of foods, a CSV meal plan, and a +number that tells you whether today works. -## Features -- Meal plan files -- Custom list of calorie amounts per serving. -- Shows total calories consumed so far and calories remaining +## Why + +Homemade meals rarely come with a calorie label, and most trackers assume a barcode or a restaurant menu. This one +assumes you looked up a food once and wrote the numbers down. + +## How it works + +Two files, both plain CSV. + +**`calorieslist.csv`** — one row per food: `name, calories, servings`, so 177 calories over 100 servings is +`chic_t, 177, 100`. Calories per serving is the division. + +**Your meal plan** — first row is the daily allowance, then one row per item you plan to eat: + +```csv +zigzag, 2200, 2100, 2050, 2300, 2400, 2600, 2500 +oatmeal, 1 +chic_t, 120 +rice_w, 186 +# a line starting with # is ignored +``` + +The allowance row is the one interesting feature: a single number means "the same every day", and `zigzag` followed +by seven numbers means a different allowance per weekday, which is how training days and rest days actually work. +Anything that cannot be parsed as a compliant row exits with a message rather than counting wrong. + +Output is three numbers — allowed today, in the plan, and the excess — followed by a progress bar: + +``` +Calories Allowed Today: 2200 +Calories In Plan: 1985 +Excess calories: -215 +Percent of Calories|███████████████████████████████ | 90/100 +``` ## Usage + ```bash -python3 mealman.py +pip install -r requirements.txt +python3 mealman.py ``` + +Requires Python 3 and `tqdm`. The plan path is relative to the current directory, and `calorieslist.csv` is read +from the working directory, so keep the two together. + +## GUI + +`gui.py` is a PyQt5 front end for the same logic: pick a meal plan file, it runs `./mealman.py` worth of work in a +subprocess, then shows the percentage in a progress bar with the parsed rows in a table. It expects `mealman.py` to +be executable and in the same directory. + +```bash +pip install PyQt5 +python3 gui.py +``` + +The CLI is the part that gets used; the GUI exists because a progress bar was more satisfying than a number at the +end of a terminal. + +## Status + +Written in 2022 and not maintained. `ifequal`-style edge cases are not handled beyond the format checks above, and +there are no tests — if I rewrote it, the parsing would be a small library with tests, and the GUI would read that +instead of shelling out. + +## Licence + +MIT. + +--- + +This README was written by an AI assistant (Particle-1) on the maintainer's behalf on 2026-12-01, by reading +the code. Original project notes and the 2022 code are the maintainer's; corrections welcome.