Converts an email into a blog post.
Reads an IMAP email account, and commits a Hugo-style markdown post and images files to Github.
Apache 2.0
dogpost [OPTIONS] --imap-user <IMAP_USER> --imap-password <IMAP_PASSWORD> --github-token <GITHUB_TOKEN> --github-repo <GITHUB_REPO>
NB:
--expurgewill archive/delete the email after processing.--dry-runwill not commit files to Git, but will print information about file locations.
Requires https://imagemagick.org to be installed.
docker build -t dogpost .
docker run -it --rm --name running-dogpost dogpost
The homeassistant/ folder contains a local add-on for Home Assistant.
The add-on stays running and runs dogpost once each time an automation sends it a line of input.
Each run processes one email.
Install steps from macOS:
- In Home Assistant go to Settings > Apps, and install Samba share.
- On the add-on's Configuration tab set a username and password, save, then Start it.
- On the Mac, in Finder choose Go > Connect to Server (⌘K) and enter
smb://homeassistant.local/addons(or use IP address if that doesn't work). Log in with the Samba username and password. The share mounts at/Volumes/addons. - Check you can access the addons from your terminal:
ls /Volumes/addons. If you can't check System Settings > Privacy & Security > Files and Folders and for your terminal all turn on "Network Volumes".
From the root of this repository:
./homeassistant/install.sh
This copies the add-on files plus Cargo.toml, Cargo.lock and src/ into /Volumes/addons/dogpost.
Pass a different folder as an argument if the share is mounted elsewhere.
- In Home Assistant go to Settings > Apps and click Install App. Select
dogpostand then press Install.
The Pi will now compile the code and this will take a while.
On the add-on's Configuration tab fill in all the settings!
Save, then Start the add-on. The Log tab should show dogpost: waiting for triggers.
Use the hassio.addon_stdin action (the add-on's id is local_dogpost).
For example, with the IMAP integration watching the mailbox:
alias: Dogpost on new email
triggers:
- trigger: event
event_type: imap_content
event_data:
initial: true
actions:
- action: hassio.addon_stdin
data:
addon: local_dogpost
input: run
mode: queuedTo test by hand, go to Developer tools > Actions, run hassio.addon_stdin with the data above, and watch the add-on's Log tab.
After changing the code, run ./homeassistant/install.sh again, press the "refresh" icon on the Apps page in HA, then select Update on the app's page.
After changing homeassistant/dogpost/config.yaml (e.g., the settings), Rebuild is not enough:
-
Increase
versioninconfig.yaml. -
Run
./homeassistant/install.sh. -
In the Home Assistant Terminal:
ha store reload ha apps update local_dogpost