-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathsicp.sh
executable file
·32 lines (25 loc) · 1005 Bytes
/
sicp.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/env bash
# Mac OS X
# export PATH="/Applications/calibre.app/Contents/MacOS/:$PATH"
# npm i puppeteer --save
# sicp.sh
function convertmenu {
local file=$1
local title=$2
echo "converting to $title.epub"
ebook-convert "$file" "$title.epub" --title "$title" --breadth-first \
--level1-toc '//h:body/h:p/h:b/h:a' \
--level2-toc '//h:body/h:p/h:a' \
--level3-toc '' \
--no-chapters-in-toc \
--use-auto-toc \
--epub-inline-toc --output-profile=kindle_pw \
--publisher MIT --authors "Harold Abelson and Gerald Jay Sussman with Julie Sussman" --language=en --cover=mitpress.mit.edu/sites/default/files/sicp/full-text/book/cover.jpg
echo "converting to $title.mobi"
ebook-convert "$title.epub" "$title.azw3" --output-profile=kindle_pw
}
function download_convert {
rm -f "mitpress.mit.edu/sites/default/files/sicp/full-text/book/book-Z-H-38.html"
convertmenu "mitpress.mit.edu/sites/default/files/sicp/full-text/book/book-Z-H-4.html" "SICP"
}
download_convert