updating documentation for the project
This commit is contained in:
46
CLAUDE.md
46
CLAUDE.md
@@ -4,6 +4,48 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
|
|||||||
|
|
||||||
## Project
|
## Project
|
||||||
|
|
||||||
**morningedition** — a morning edition printable newspaper generator.
|
**morningedition** — prints a daily morning "newspaper" receipt on an Epson TM-T88V thermal printer
|
||||||
|
at 6:30am via cron. One Python script, no dependencies beyond stdlib.
|
||||||
|
|
||||||
This repository is in early/empty state. No build system, dependencies, or code structure has been established yet.
|
## Printer
|
||||||
|
|
||||||
|
- **Model:** Epson TM-T88V (M244A), USB, 80mm paper rolls
|
||||||
|
- **CUPS name:** `receipt`
|
||||||
|
- **Print command:** `lpr -P receipt -o raw` — raw ESC/POS, do not use CUPS rendering mode
|
||||||
|
- **Paper cut:** `GS V 0x00` ESC/POS byte in the output stream
|
||||||
|
- **ASCII only** — no emoji, no unicode; use `.encode("ascii", errors="replace")`
|
||||||
|
- **Current WIDTH = 30** — printer NV is locked to 58mm mode; fix via Epson TM Utility
|
||||||
|
(Windows) then set WIDTH = 42. Do not change WIDTH without fixing the printer first.
|
||||||
|
|
||||||
|
## Architecture
|
||||||
|
|
||||||
|
`morningedition.py` is a single self-contained script:
|
||||||
|
|
||||||
|
1. Fetches weather from `wttr.in/{zipcode}?format=j1` (JSON)
|
||||||
|
2. Fetches RSS headlines from ABC13 and BBC
|
||||||
|
3. Builds a receipt as a list of ASCII text lines
|
||||||
|
4. Wraps lines in ESC/POS framing bytes (`INIT + FONT_A + body + CUT`)
|
||||||
|
5. Pipes raw bytes to `lpr -P receipt -o raw`
|
||||||
|
|
||||||
|
The `--preview` flag dumps the text portion to stdout instead of printing.
|
||||||
|
|
||||||
|
## Key constants (morningedition.py)
|
||||||
|
|
||||||
|
| Constant | Value | Notes |
|
||||||
|
|---|---|---|
|
||||||
|
| `WIDTH` | 30 | chars per line; change to 42 after fixing printer NV |
|
||||||
|
| `PRINTER` | `"receipt"` | CUPS printer name |
|
||||||
|
| `ZIPCODE` | `"77433"` | Bridgeland, Cypress TX |
|
||||||
|
| `NAME` | `"Rich"` | used in greeting |
|
||||||
|
|
||||||
|
## Content rotation
|
||||||
|
|
||||||
|
Quotes, jokes, facts, and local tips rotate by `day_of_year % len(list)` — no state file needed.
|
||||||
|
|
||||||
|
## What to avoid
|
||||||
|
|
||||||
|
- Do not use `lpr -o TmxPaperCut=CutPerJob` — CUPS mode renders at huge font size
|
||||||
|
- Do not use emoji or unicode characters anywhere in output
|
||||||
|
- Do not add external dependencies; stdlib only
|
||||||
|
- NHL API (`api-web.nhle.com`) returns 403 — do not use
|
||||||
|
- `investing.com` scraping is unreliable — do not use
|
||||||
|
|||||||
61
README.md
61
README.md
@@ -1,3 +1,62 @@
|
|||||||
# morningedition
|
# morningedition
|
||||||
|
|
||||||
Morning Edition printable newspaper
|
A daily morning receipt printer for the Epson TM-T88V thermal printer.
|
||||||
|
Prints a personalized "newspaper" every morning at 6:30am via cron.
|
||||||
|
|
||||||
|
## What it prints
|
||||||
|
|
||||||
|
- **Header** — date, time, location (Bridgeland, Cypress TX)
|
||||||
|
- **On This Day** — historical fact for today's date (when available)
|
||||||
|
- **Weather** — current conditions, hi/lo, humidity, UV, wind, sunrise/sunset via wttr.in
|
||||||
|
- **Houston News** — 5 live headlines from ABC13 RSS
|
||||||
|
- **World News** — 5 live headlines from BBC RSS
|
||||||
|
- **Thought for the Day** — rotating daily quote
|
||||||
|
- **Morning Chuckle** — rotating daily joke
|
||||||
|
- **Did You Know?** — rotating daily fun fact
|
||||||
|
- **Local Tip** — rotating Bridgeland/Houston tips
|
||||||
|
|
||||||
|
## Requirements
|
||||||
|
|
||||||
|
- Python 3 (stdlib only, no pip installs needed)
|
||||||
|
- Epson TM-T88V connected via USB, configured in CUPS as printer name `receipt`
|
||||||
|
- Internet connection at print time (weather + news)
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Print to printer
|
||||||
|
python3 morningedition.py
|
||||||
|
|
||||||
|
# Preview in terminal (no printing)
|
||||||
|
python3 morningedition.py --preview
|
||||||
|
```
|
||||||
|
|
||||||
|
## Cron setup
|
||||||
|
|
||||||
|
Already configured at 6:30am Central Time:
|
||||||
|
|
||||||
|
```
|
||||||
|
CRON_TZ=America/Chicago
|
||||||
|
30 6 * * * /usr/bin/python3 /home/rich/Devel/morningedition/morningedition.py
|
||||||
|
```
|
||||||
|
|
||||||
|
## Printer notes
|
||||||
|
|
||||||
|
- Prints in **raw ESC/POS mode** (`lpr -P receipt -o raw`) — faster and more reliable than CUPS rendering
|
||||||
|
- Paper cut is handled via `GS V 0x00` in the ESC/POS byte stream
|
||||||
|
- ASCII only — no emoji or unicode
|
||||||
|
- `WIDTH = 30` currently because the printer NV memory is locked to 58mm paper mode
|
||||||
|
(even though 80mm rolls are loaded). To fix: use Epson TM Utility on Windows to set
|
||||||
|
Memory Switch → Paper Width → 80mm, then change `WIDTH = 30` → `WIDTH = 42` in
|
||||||
|
`morningedition.py` line 23.
|
||||||
|
|
||||||
|
## Files
|
||||||
|
|
||||||
|
| File | Purpose |
|
||||||
|
|---|---|
|
||||||
|
| `morningedition.py` | Main script |
|
||||||
|
| `diagnose.py` | ESC/POS font/width diagnostic prints |
|
||||||
|
| `diagnose2.py` | Print area and character spacing diagnostics |
|
||||||
|
| `fixwidth.py` | NV paper-width fix attempts (v1) |
|
||||||
|
| `fixwidth2.py` | NV memory switch sweep (v2) |
|
||||||
|
| `readmsw.py` | Attempted memory switch readback via USB |
|
||||||
|
|||||||
Reference in New Issue
Block a user