Files
morningedition/CLAUDE.md

1.9 KiB

CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

Project

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.

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