diff options
author | Patryk Niedźwiedziński <pniedzwiedzinski19@gmail.com> | 2021-06-05 12:59:41 +0200 |
---|---|---|
committer | Patryk Niedźwiedziński <pniedzwiedzinski19@gmail.com> | 2021-06-05 12:59:41 +0200 |
commit | 93a313747cad2dc29e9763b8ef0ed07853f55e60 (patch) | |
tree | 3be36a91afbf8bf9e5e942035c328413ed7b2925 | |
parent | c5770bb51c8f23fca0a1e16d047c3f798d8b16ea (diff) | |
download | niedzwiedzinski.cyou-93a313747cad2dc29e9763b8ef0ed07853f55e60.tar.gz niedzwiedzinski.cyou-93a313747cad2dc29e9763b8ef0ed07853f55e60.zip |
azymut2mobi
-rw-r--r-- | src/blog/2021-06-05.gmi | 9 | ||||
-rw-r--r-- | src/tools/azymut2mobi.gmi | 5 | ||||
-rwxr-xr-x | src/tools/azymut2mobi.sh | 17 |
3 files changed, 31 insertions, 0 deletions
diff --git a/src/blog/2021-06-05.gmi b/src/blog/2021-06-05.gmi new file mode 100644 index 0000000..fe3e2d9 --- /dev/null +++ b/src/blog/2021-06-05.gmi @@ -0,0 +1,9 @@ +# 2021-06-05 | Kindle is my new reader + +Inspiration: +=> https://m-chrzan.xyz/blog/downloading-articles-for-my-ebook-reader.html +=> https://jacobwsmith.xyz/stories/ereader_blog.html + +azymut.zhr.pl is a site for scout leaders to enable knowledge and experience sharing between scouts. As I myself am a scout leader I read a lot articles from them. That's why I created a tool for converting them to `mobi` so I can read them on my ebook reader. + +=> /tools/azymut2mobi.gmi diff --git a/src/tools/azymut2mobi.gmi b/src/tools/azymut2mobi.gmi new file mode 100644 index 0000000..fd8bfda --- /dev/null +++ b/src/tools/azymut2mobi.gmi @@ -0,0 +1,5 @@ +# azymut2mobi + +Convert articles from azymut.zhr.pl to mobi and move them to kindle. + +=> azymut2mobi.sh Download script diff --git a/src/tools/azymut2mobi.sh b/src/tools/azymut2mobi.sh new file mode 100755 index 0000000..7f84969 --- /dev/null +++ b/src/tools/azymut2mobi.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +tmp=$(mktemp /tmp/azymut.XXX.html) + +title=$(echo $1 | rev | cut -d'/' -f1 | rev) +first=$(echo $title | cut -c 1) +[ -z $first ] && title=$(echo $1 | rev | cut -d'/' -f2 | rev) +[ "$first" = "?" ] && title=$(echo $1 | rev | cut -d'/' -f2 | rev) + +neattitle=$(curl $1 | grep "<title" | sed 's/<\/\?title>//g' | xargs) +curl $1 | sed -n '/<article/,/<div class="saboxplugin/p' | head -n -1 > $tmp + +pandoc $tmp -V pagestyle=empty -o /tmp/$title.epub --metadata title="$neattitle" +ebook-convert /tmp/$title.epub /tmp/$title.mobi --title "$neattitle" --authors "Azymut" + +KINDLE_DEV=/dev/disk/by-uuid/5068-DD06 +[ -L $KINDLE_DEV ] && sudo mount $KINDLE_DEV /mnt/void && sudo cp /tmp/$title.mobi /mnt/void/documents && sudo umount /mnt/void |