Skip to content

Modderjoch/substack-newspaper-printer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A Substack Newspaper Printer

A small automation script that checks unread email for substack links, uses substackprint.com to generate a newspaper from the links found, and sends it directly to a printer using CUPS.

Features

  • Automatically downloads and generates newspapers
  • Sends the PDF directly to a printer
  • Supports black/color printing modes
  • Configurable through environment variables
  • Made to run continuously on a pi or similar

Requirements

The following software must be installed:

  • Python 3.9+
  • CUPS

Any required Python packages can be installed by running:

pip install -r requirements.txt

Installation

Clone the repository:

git clone https://github.com/yourusername/substack-newspaper-printer.git
cd substack-newspaper-printer

Install depedencies:

pip install -r requirements.txt

Create a configuration file:

cp .env.example .env

Edit the configuration:

nano .env

Configuration

Environment variables are used for configuration. Example .env:

# EMAIL AUTHENTICATION
EMAIL_USER=youremailhere@email.com
EMAIL_PASS=youremailpasswordhere
IMAP_SERVER=yourimap.server.here

# NEWSPAPER SETTINGS
NEWSPAPER_NAME=The Substack Printer
FOOTER_TEXT="Printed with help from The Substack Printer made with <3 by Modderjoch - github.com/modderjoch"

# PRINTER SETTINGS
PRINTER_NAME=YOUR_PRINTER_NAME 
PRINTER_COLOR_MODE=black

# Find your printer name by running lpstat -p
# Set PRINTER_COLOR_MODE to either black OR color

Find your printer name by running lpstat -p, then use the name returned in the .env file.

Running

Run the script:

./run.sh

The script will:

  1. Check the provided email adress for any unread emails with substack links in the body.
  2. Generate the newspaper
  3. Download the newspaper and save it to /output
  4. Send the newspaper to the configured printer

Running in the background (optional)

You can run it inside a screen session:

screen -S newspaper
.run/sh

Detach: CTRL + A + D Reattach:

screen -r newspaper

Cron automation

Example cron job that runs every morning:

0 8 * * * /path/to/substack-newspaper-printer/run.sh
Made with <3 by Modderjoch

About

A small automation script that checks unread mail for substack links, uses substackprint.com to generate a newspaper, and sends it directly to a printer using CUPS.

Resources

Stars

Watchers

Forks

Releases

No releases published

Contributors