updated readme to the new python script

This commit is contained in:
lorenz 2024-02-14 08:50:28 +01:00
parent e2173bb999
commit 62e23de949

View File

@ -1,14 +1,15 @@
# !! Readme is not up to date
# Calendar Generator Flask App # Calendar Generator Flask App
This python application generates a pdf-file based calendar with images and associated texts for each day. It's designed to read images and texts from specified directories and display them in a calendar format. Per DIN A4 page 4 days get displayed.
This Flask application generates a web-based calendar view with images and associated texts for each day. It's designed to read images and texts from specified directories and display them in a calendar format. The web-based pages can be printed to a pdf-file. This is easy, because every browser application has the option to print a page to a pdf-file. Per DIN A4 page 4 days get displayed.
## Setup ## Setup
### Prerequisites ### Prerequisites
- Python 3.x - Python 3.x
- Flask
- Basic understanding of Python and Flask - Basic understanding of Python and Flask
- reportlab (python modul)
- os (python modul)
- re (python modul)
- textwrap (python modul)
### Installation ### Installation
@ -18,9 +19,9 @@ This Flask application generates a web-based calendar view with images and assoc
2. **Install Required Packages** 2. **Install Required Packages**
Flask is required and can be installed via pip: reportlab is required and can be installed via pip:
```bash ```bash
pip install Flask pip install reportlab
`````` ``````
### Folder Structure ### Folder Structure
@ -32,19 +33,18 @@ project_folder/
│ app.py │ app.py
│ README.md │ README.md
├───static/ ├───images/
│ └───images/ │ │ 2024-01-15.jpg
│ │ 2024-01-15.jpg │ │ 2024-01-16.png
│ │ 2024-01-16.png │ ...
│ ...
└───texts/ └───texts/
│ 2024-01-15.txt │ 2024-01-15.txt
│ 2024-01-16.txt │ 2024-01-16.txt
... ...
``` ```
- `app.py`: Main Flask application file. - `app.py`: Main python application file.
- `static/images/`: Directory for storing calendar images. Images should be named `YYYY-MM-DD.extension`. - `images/`: Directory for storing calendar images. Images should be named `YYYY-MM-DD.extension`.
- `texts/`: Directory for storing text files corresponding to each day, named `YYYY-MM-DD.txt`. - `texts/`: Directory for storing text files corresponding to each day, named `YYYY-MM-DD.txt`.
### Running the Application ### Running the Application
@ -54,13 +54,11 @@ project_folder/
```bash ```bash
python app.py python app.py
`````` ``````
3. Access the calendar in a web browser at `http://127.0.0.1:5000/`. 3. "PDF created successfully" shoud appear, then you can access the pdf file which is in the same directory as the script.
## How It Works ## How It Works
- The application serves a web page displaying a calendar.
- Each day on the calendar can have an image and a text associated with it. - Each day on the calendar can have an image and a text associated with it.
- Images are read from `static/images/`, and text files are from `texts/`. - Images are read from `images/`, and text files are from `texts/`.
- Files are matched based on their filenames, formatted as `YYYY-MM-DD`. - Files are matched based on their filenames, formatted as `YYYY-MM-DD`.
- The calendar is dynamically generated based on available images and texts. - The calendar is dynamically generated based on available images and texts.
- If an image or text is not available for a specific day, it will be displayed without that content. - If an image or text is not available for a specific day, it will be displayed without that content.
@ -68,7 +66,6 @@ project_folder/
## Notes ## Notes
- Text for each day should be concise. Lengthy texts may be truncated in the display to maintain the layout of the calendar. - Text for each day should be concise. Lengthy texts may be truncated in the display to maintain the layout of the calendar.
- You can customize the appearance and behavior of the calendar by modifying the HTML, CSS, and Flask application logic.
## Copyright and license ## Copyright and license
This code is for my very good friend Felix W.. Code copyright 2024 Lorenz B. This code is for my very good friend Felix W.. Code copyright 2024 Lorenz B.