# brick-24/paper-feed architecture

> Architecture diagram of the GitHub repository brick-24/paper-feed, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/brick-24/paper-feed
- Repository: https://github.com/brick-24/paper-feed

## Overview

Paper-feed is a command-line personal thermal newspaper: a user selects briefing sections or custom content, `main.py` dispatches each action, and the selected feature formats results through a printer. The default feed combines date, current weather, market summary, quote, and weekly forecast; optional branches cover stocks, XKCD, news, text, images, and stock charts. Source excerpts show weather and forecast providers, Yahoo Finance use, RSS fetching, and printer output. Quote/date and some input-module internals are represented only from the tree and README, so their internal data flow is not expanded.

Main entry points: [`main.py`](https://github.com/brick-24/paper-feed/blob/main/main.py) (Action dispatcher), [`printer.py`](https://github.com/brick-24/paper-feed/blob/main/printer.py) (Printer adapter), [`function/markets.py`](https://github.com/brick-24/paper-feed/blob/main/function/markets.py) (Market summary), [`function/stock_performance.py`](https://github.com/brick-24/paper-feed/blob/main/function/stock_performance.py) (Market performance table)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_dispatch["CLI dispatch"]
  node_main["Action dispatcher<br/>[main.py]"]
  node_config["Defaults and tickers<br/>[config.py]"]
end

subgraph group_briefings["Briefing content"]
  node_weather["Current weather<br/>[weather.py]"]
  node_forecast["Weekly forecast<br/>[forecast.py]"]
  node_quote["Inspirational quote<br/>[quote.py]"]
  node_daydate["Date section<br/>[daydate.py]"]
  node_comic["XKCD comic<br/>[comic.py]"]
  node_news["RSS headlines<br/>[news.py]"]
  node_textinput["Custom text<br/>[text_inp.py]"]
  node_imageinput["Local image<br/>[image_inp.py]"]
end

subgraph group_finance["Market data"]
  node_markets["Market summary<br/>[markets.py]"]
  node_stock["Stock lookup<br/>[stock.py]"]
  node_stockgraph["Stock chart<br/>[draw_graph.py]"]
  node_marketperformance["Market performance table"]
end

subgraph group_output["Printer output"]
  node_printer["Printer adapter<br/>[printer.py]"]
end

node_user(("CLI user"))
node_usbprinter["USB ESC/POS printer"]
node_terminal["Terminal output"]
node_wttr["wttr.in"]
node_openmeteo["Open-Meteo"]
node_yahoo["Yahoo Finance"]
node_rss["RSS feed"]
node_xkcdservice["XKCD service"]
node_localimage["Local image file"]
node_chartfile["Generated chart file"]

node_user -->|"selects action"| node_main
node_main -->|"reads defaults"| node_config
node_main -->|"creates printer"| node_printer
node_main -->|"dispatches"| node_weather
node_main -->|"dispatches"| node_forecast
node_main -->|"dispatches"| node_quote
node_main -->|"dispatches"| node_daydate
node_main -->|"dispatches"| node_comic
node_main -->|"dispatches"| node_news
node_main -->|"dispatches"| node_textinput
node_main -->|"dispatches"| node_imageinput
node_main -->|"dispatches"| node_markets
node_main -->|"dispatches"| node_stock
node_main -->|"dispatches"| node_stockgraph
node_main -->|"dispatches"| node_marketperformance
node_weather -->|"requests weather"| node_wttr
node_forecast -->|"geocodes and forecasts"| node_openmeteo
node_markets -->|"reads tickers"| node_config
node_markets -->|"requests prices"| node_yahoo
node_stock -->|"requests prices"| node_yahoo
node_marketperformance -->|"reads tickers"| node_config
node_marketperformance -->|"requests prices"| node_yahoo
node_stockgraph -->|"requests history"| node_yahoo
node_stockgraph -->|"writes chart"| node_chartfile
node_news -->|"parses feed"| node_rss
node_comic -->|"fetches comic"| node_xkcdservice
node_imageinput -->|"reads image"| node_localimage
node_weather -->|"formats output"| node_printer
node_forecast -->|"formats output"| node_printer
node_quote -->|"formats output"| node_printer
node_daydate -->|"formats output"| node_printer
node_comic -->|"prints text and image"| node_printer
node_news -->|"prints headlines"| node_printer
node_textinput -->|"prints text"| node_printer
node_imageinput -->|"prints image"| node_printer
node_markets -->|"prints summary"| node_printer
node_stock -->|"prints details"| node_printer
node_marketperformance -->|"prints table"| node_printer
node_printer -->|"sends print data"| node_usbprinter
node_printer -->|"writes test output"| node_terminal

click node_main "https://github.com/brick-24/paper-feed/blob/main/main.py"
click node_config "https://github.com/brick-24/paper-feed/blob/main/config.py"
click node_weather "https://github.com/brick-24/paper-feed/blob/main/function/weather.py"
click node_forecast "https://github.com/brick-24/paper-feed/blob/main/function/forecast.py"
click node_quote "https://github.com/brick-24/paper-feed/blob/main/function/quote.py"
click node_daydate "https://github.com/brick-24/paper-feed/blob/main/function/daydate.py"
click node_comic "https://github.com/brick-24/paper-feed/blob/main/function/comic.py"
click node_news "https://github.com/brick-24/paper-feed/blob/main/function/news.py"
click node_textinput "https://github.com/brick-24/paper-feed/blob/main/function/text_inp.py"
click node_imageinput "https://github.com/brick-24/paper-feed/blob/main/function/image_inp.py"
click node_markets "https://github.com/brick-24/paper-feed/blob/main/function/markets.py"
click node_stock "https://github.com/brick-24/paper-feed/blob/main/function/stock.py"
click node_stockgraph "https://github.com/brick-24/paper-feed/blob/main/function/draw_graph.py"
click node_marketperformance "https://github.com/brick-24/paper-feed/blob/main/function/stock_performance.py"
click node_printer "https://github.com/brick-24/paper-feed/blob/main/printer.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_main,node_config,node_user toneBlue
class node_weather,node_forecast,node_quote,node_daydate,node_comic,node_news,node_textinput,node_imageinput toneAmber
class node_markets,node_stock,node_stockgraph,node_marketperformance toneMint
class node_printer toneRose
class node_usbprinter,node_terminal,node_wttr,node_openmeteo,node_yahoo,node_rss,node_xkcdservice,node_localimage,node_chartfile toneIndigo
```

## Components

### CLI dispatch

- [Action dispatcher](https://github.com/brick-24/paper-feed/blob/main/main.py): `main.py`
- [Defaults and tickers](https://github.com/brick-24/paper-feed/blob/main/config.py): `config.py`

### Briefing content

- [Current weather](https://github.com/brick-24/paper-feed/blob/main/function/weather.py): `function/weather.py`
- [Weekly forecast](https://github.com/brick-24/paper-feed/blob/main/function/forecast.py): `function/forecast.py`
- [Inspirational quote](https://github.com/brick-24/paper-feed/blob/main/function/quote.py): `function/quote.py`
- [Date section](https://github.com/brick-24/paper-feed/blob/main/function/daydate.py): `function/daydate.py`
- [XKCD comic](https://github.com/brick-24/paper-feed/blob/main/function/comic.py): `function/comic.py`
- [RSS headlines](https://github.com/brick-24/paper-feed/blob/main/function/news.py): `function/news.py`
- [Custom text](https://github.com/brick-24/paper-feed/blob/main/function/text_inp.py): `function/text_inp.py`
- [Local image](https://github.com/brick-24/paper-feed/blob/main/function/image_inp.py): `function/image_inp.py`

### Market data

- [Market summary](https://github.com/brick-24/paper-feed/blob/main/function/markets.py): `function/markets.py`
- [Stock lookup](https://github.com/brick-24/paper-feed/blob/main/function/stock.py): `function/stock.py`
- [Stock chart](https://github.com/brick-24/paper-feed/blob/main/function/draw_graph.py): `function/draw_graph.py`
- [Market performance table](https://github.com/brick-24/paper-feed/blob/main/function/stock_performance.py): `function/stock_performance.py`

### Printer output

- [Printer adapter](https://github.com/brick-24/paper-feed/blob/main/printer.py): `printer.py`

### Other components

- **CLI user**
- **USB ESC/POS printer**
- **Terminal output**
- **wttr.in**
- **Open-Meteo**
- **Yahoo Finance**
- **RSS feed**
- **XKCD service**
- **Local image file**
- **Generated chart file**

## Connections

- CLI user → Action dispatcher: selects action
- Action dispatcher → Defaults and tickers: reads defaults
- Action dispatcher → Printer adapter: creates printer
- Action dispatcher → Current weather: dispatches
- Action dispatcher → Weekly forecast: dispatches
- Action dispatcher → Inspirational quote: dispatches
- Action dispatcher → Date section: dispatches
- Action dispatcher → XKCD comic: dispatches
- Action dispatcher → RSS headlines: dispatches
- Action dispatcher → Custom text: dispatches
- Action dispatcher → Local image: dispatches
- Action dispatcher → Market summary: dispatches
- Action dispatcher → Stock lookup: dispatches
- Action dispatcher → Stock chart: dispatches
- Action dispatcher → Market performance table: dispatches
- Current weather → wttr.in: requests weather
- Weekly forecast → Open-Meteo: geocodes and forecasts
- Market summary → Defaults and tickers: reads tickers
- Market summary → Yahoo Finance: requests prices
- Stock lookup → Yahoo Finance: requests prices
- Market performance table → Defaults and tickers: reads tickers
- Market performance table → Yahoo Finance: requests prices
- Stock chart → Yahoo Finance: requests history
- Stock chart → Generated chart file: writes chart
- RSS headlines → RSS feed: parses feed
- XKCD comic → XKCD service: fetches comic
- Local image → Local image file: reads image
- Current weather → Printer adapter: formats output
- Weekly forecast → Printer adapter: formats output
- Inspirational quote → Printer adapter: formats output
- Date section → Printer adapter: formats output
- XKCD comic → Printer adapter: prints text and image
- RSS headlines → Printer adapter: prints headlines
- Custom text → Printer adapter: prints text
- Local image → Printer adapter: prints image
- Market summary → Printer adapter: prints summary
- Stock lookup → Printer adapter: prints details
- Market performance table → Printer adapter: prints table
- Printer adapter → USB ESC/POS printer: sends print data
- Printer adapter → Terminal output: writes test output
