Created
June 15, 2021 01:23
-
-
Save nfd9001/d87feafc4e872349f42f23ad4124c47b to your computer and use it in GitHub Desktop.
link-to-rm: Convenience script to send URLs to Remarkable Cloud
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Usage: link-to-rm [URI] (keep) | |
# Deps: pandoc, wget, rmapi (make sure you're signed in and /link-to-rm exists) | |
name=$(basename "$1") | |
ext="${name##*.}" | |
mkdir -p /tmp/link-to-rm | |
cd /tmp/link-to-rm || exit | |
if [ "$ext" = "pdf" ] || [ "$ext" = "epub" ] | |
then | |
wget "$1" | |
else | |
pandoc "$1" -o "$name.epub" | |
fi | |
rmapi mput /link-to-rm | |
if [ -n "$2" ] | |
then | |
mkdir -p ~/link-to-rm-docs/ | |
cp ./* ~/link-to-rm-docs | |
fi | |
rm /tmp/link-to-rm/* |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment