-- Leo's gemini proxy

-- Connecting to alpha.lyk.so:1965...

-- Connected

-- Sending request

-- Meta line: 20 text/gemini;

e-reader


Updated 2021-07-23


latest


I added a Bluetooth transmitter to my setup, which has allowed me to listen to documents on my Bluetooth headphones while working with my hands. So far I'm finding it quite helpful.


2021-07-14


Many years ago, I bought an e-ink Kindle Touch. I find it's quite useful for focusing on a single piece of content. Lately I've been using it with Calibre to trim down my browser's tab count. Two scripts are involved, one which converts the page in question to an ebook and one which uploads everything to my e-reader once it's mounted.


#!/usr/bin/env sh

# Dependencies:
# calibre

set -e

EBOOK_DIR="$HOME/extramuros/documents/ebooks"

[ "$2" ] || { >&2 echo "usage: $0 <author> <URL> [formats]"; exit 1; }

temp="$(mktemp -d)"
trap 'rm -fr "$temp"' EXIT INT HUP

web2disk -r0 -d "$temp" "$2"

fname="$(basename "$2")"
formats="${3:-epub,mobi}" # Mobi is compatible with old Kindles
mkdir -p "$EBOOK_DIR/$1"

echo "$formats" | tr , "\n" | while read format; do
  dest="$EBOOK_DIR/$1/${fname%.*}.$format"

  ebook-convert "$temp/"*.xhtml "$dest"
  ebook-meta -a "$(echo "$1" | sed 's/ and / & /')" --identifier "uri:$2" "$dest"
done

echo "Done!"

scripts/ebook-from-web.sh


#!/usr/bin/env sh

set -e

# Guess the directory the Kindle is mounted to
kindle="$(find /media -type d -name amazon-cover-bug -exec dirname {} \;)"

[ "$kindle" ] || { >&2 echo "Could not find Kindle."; exit 1; }

# The old Kindle only knows about mobi files
rsync -rv --include="*/" --include="*.mobi" --exclude="*" \
  "$HOME/extramuros/documents/ebooks/" "$kindle/documents/"

scripts/ebooks-upload.sh


I hadn't written these for general use, so at the very least you will need to change the "extramuros" path to point to wherever you like to save your ebooks. You may also need to change the second script to look for a different file, possibly under a different directory, to identify where your e-reader is mounted, and you may also need to change where rsync uploads the files. (That script is, upon reflection, quite specific to my Kindle.)


relevant links:


Calibre

-- Response ended

-- Page fetched on Fri May 3 11:05:08 2024