-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrun.sh
More file actions
executable file
·49 lines (41 loc) · 1.74 KB
/
Copy pathrun.sh
File metadata and controls
executable file
·49 lines (41 loc) · 1.74 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/bash
BOOKS="elantris mistborn mistborn2 mistborn3 mistborn4 stormlight warbreaker"
declare -A URLS
declare -A TITLES
URLS[elantris]="http://brandonsanderson.com/annotation-elantris-introduction/"
TITLES[elantris]="Elantris"
URLS[mistborn]="http://www.brandonsanderson.com/annotation-mistborn-title-page-one/"
TITLES[mistborn]="Mistborn: The Final Empire"
URLS[mistborn2]="http://brandonsanderson.com/annotation-mistborn-2-title-page/"
TITLES[mistborn2]="Mistborn: The Well of Ascension"
URLS[mistborn3]="http://brandonsanderson.com/annotation-mistborn-3-dedication/"
TITLES[mistborn3]="Mistborn: Hero of Ages"
URLS[mistborn4]="https://www.brandonsanderson.com/annotation-the-alloy-of-law-chapter-two/"
TITLES[mistborn4]="Wax and Wayne: Alloy of Law"
URLS[stormlight]="https://www.brandonsanderson.com/annotation-the-way-of-kings-introduction/"
TITLES[stormlight]="The Stormlight Archives: The Way of Kings"
URLS[warbreaker]="http://brandonsanderson.com/annotation-warbreaker-dedication/"
TITLES[warbreaker]="Warbreaker"
# need to check if requirements are satisfied
# better to fail now than later
./check_requirements.py || { echo 'Requirements not satisfied'; exit 1; }
for book in $BOOKS; do
url=${URLS[$book]}
title=${TITLES[$book]}
datadir="epub/${book}-data"
epubdir="epub/${book}-annotations"
echo "Creating annotations book for $book from $url"
# Get data
if [ ! -d $datadir ]; then
mkdir -p $datadir
fi
./get_book.py "$title" "Brandon Sanderson" "$url" "$datadir" || { echo 'Failed to get book data'; exit 1; }
echo ""
# Create book
rm -rf $epubdir
rm -rf epub/${book}*.epub
mkdir -p $datadir
echo "Creating ePub"
./gen_epub.py "$datadir" "$epubdir" || { echo 'Failed to generate book'; exit 1; }
echo "Created"
done