git » urraka » next » tree

[next] / kindle / urraka-kindle-sync

#!/bin/sh

# Sync with the urraka.
# $1: secret URL for syncing.
#     Should look like http://domain/urraka/index.cgi/b/YOURSECRET/
# $2: optional, destination path. Defaults to -/mnt/us/documents/ which is
#     what the kindle needs.

SECRET_URL=$1
URLS=$(wget -q -O - $SECRET_URL)

cd ${2:-/mnt/us/documents/}

FETCHED=no

for U in $URLS; do
	F="$(basename $U $(dirname $U))"
	if ! test -e "$F"; then
		wget -q $U
		FETCHED=yes
	fi
done

if [ $FETCHED = yes ]; then
	# Trigger a book refresh in Amazon's software.
	dbus-send --system /default com.lab126.powerd.resuming int32:1
fi