Skip to content

Instantly share code, notes, and snippets.

@ajpen
Created March 8, 2021 15:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ajpen/d2c4862f0a34145179dffe889731e841 to your computer and use it in GitHub Desktop.
Save ajpen/d2c4862f0a34145179dffe889731e841 to your computer and use it in GitHub Desktop.
Script to curate and downloads articles to kindle.
#!/bin/bash
# Uncomment for debugging
set -xe
# Be sure to use absolute paths here
outputDir=PATH/TO/OUTPUT/DIR
sourcesDir=PATH/TO/RECIPES/DIR
today=$(date +%y-%m-%d)
# Set up the folders first
todayDir="$outputDir/$today"
mkdir -p $todayDir
# Download articles from sources
cd $sourcesDir
for i in *.recipe; do
[ -f "$i" ] || break
# Download and curate articles from source
ebook-convert $i "$outputDir/$i-$today.mobi" --output-profile kindle
# Send curated articles
calibre-smtp -a "$outputDir/$i-$today.mobi" -s "EMAIL SUBJECT" -r imap.gmail.com --port 465 --username YOUR-EMAIL -p YOUR-APP-PASSWORD -e SSL FROM-EMAIL KINDLE-EMAIL "EMAIL-BODY (CAN BE BLANK)"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment