# What's new CEA

This project generates and sends daily/weekly updates on new tracks in chosen playlists.
It collects new entries and emails formatted reports to each recipient with its own choice of playlists.

## Features

- Fetches new tracks entries in all configured playlists.
- Generates summary cards for each playlist and track (including label/pline/distributor metadata).
- Renders HTML email reports using Jinja2 templates.
- Sends emails to subscribers for the playlists of choice.
- Logging and error handling included.

## Platforms Currently Supported

- Spotify
- (Coming Soon) Apple Music

## Quick Start

1. **Requirements & Dependencies** 
   - Python 3.11+
   - Use the provided `pyproject.toml` to set up your environment.

2. **Configure environment**  
   - Set the `LOGDIR` environment variable to specify where logs are stored.
   - Ensure access to the required table for mailing lists: prod_eu_analytics.whatsnew_distro 

3. **Run the main script**
   ```
   python src/main.py
   ```
   or  
   with arguments if you want to control mode and/or mail sending and writing the html to a file  
   1st argument is mode  
   2nd argument is to send or not emails  
   3rd argument is to write the html to a file in the tmp folder  
   ```
   python src/main.py [daily|d or weekly|w or weekend|we] [s|send|y|yes or n|no] [w|write|y|yes]
   ```

4. **Output**  
   - Emails are sent to the configured recipients.

## File Structure

- `src/main.py` — Main orchestration script.
- `src/config.py` — Configuration/Parameters.
- `src/data.py` — Data access and transformation.
- `src/mailing.py` — Building and sending emails.
- `src/utils.py` — Helpers functions
- `html/` — Jinja2 HTML templates.
- `sql/` — SQL queries
- `tmp/` — Temporary output files (PNG, HTML).
