--- /dev/null
+#!/usr/bin/env bash
+#
+# Copy all formats for the specified book(s) to a directory structure that's
+# ready to be pushed to the public website.
+#
+# Examples:
+#
+# copy-all-formats.sh 05sots
+#
+# list-bookcodes-by-series.sh gs | xargs copy-all-formats.sh
+
+if [ ! -d "$AONDIR" ]; then
+ >&2 echo "Please set the AONDIR environment variable"
+ exit
+fi
+BASE_DIR="$AONDIR/common/scripts"
+
+"$BASE_DIR/copy-xhtml.sh" "$@"
+"$BASE_DIR/copy-svg.sh" "$@"
+"$BASE_DIR/copy-ebooks.sh" "$@"
--- /dev/null
+#!/usr/bin/env bash
+#
+# Copy ebook files for the specified book(s) to a directory structure that's
+# ready to be pushed to the public website.
+#
+# Examples:
+#
+# copy-ebooks.sh 05sots
+#
+# list-bookcodes-by-series.sh gs | xargs copy-ebooks.sh
+
+if [ ! -d "$AONDIR" ]; then
+ >&2 echo "Please set the AONDIR environment variable"
+ exit
+fi
+CURR_DIR=`pwd`
+
+BASE_DIR="$AONDIR/common/epub"
+book_db="$AONDIR/common/sqlite/bookcodes.db"
+
+for book in $@
+do
+ row=($(sqlite3 -separator ' ' $book_db "select lang, series from bookcodes where book = '$book';"))
+
+ lang=${row[0]}
+ series=${row[1]}
+
+ source_dir="$BASE_DIR/$book"
+
+ for format in epub mobi fb2 pdb lrf
+ do
+ output_dir="$CURR_DIR/$lang/$format/$series"
+ mkdir -p "$output_dir"
+ cp -av "$source_dir/$book.$format" "$output_dir"
+ done
+done
--- /dev/null
+#!/usr/bin/env bash
+#
+# Copy SVG files for the specified book(s) to a directory structure that's
+# ready to be pushed to the public website.
+#
+# Examples:
+#
+# copy-svg.sh 05sots
+#
+# list-bookcodes-by-series.sh gs | xargs copy-svg.sh
+
+if [ ! -d "$AONDIR" ]; then
+ >&2 echo "Please set the AONDIR environment variable"
+ exit
+fi
+CURR_DIR=`pwd`
+
+book_db="$AONDIR/common/sqlite/bookcodes.db"
+
+for book in $@
+do
+ row=($(sqlite3 -separator ' ' $book_db "select lang, series from bookcodes where book = '$book';"))
+
+ lang=${row[0]}
+ series=${row[1]}
+
+ source_dir="$AONDIR/$lang/svg/$series"
+ output_dir="$CURR_DIR/$lang/svg/$series"
+ mkdir -p "$output_dir"
+ cp -av "$source_dir/$book.svgz" "$output_dir"
+done
--- /dev/null
+#!/usr/bin/env bash
+#
+# Copy XHTML files for the specified book(s) to a directory structure that's
+# ready to be pushed to the public website.
+#
+# Examples:
+#
+# copy-xhtml.sh 05sots
+#
+# list-bookcodes-by-series.sh gs | xargs copy-xhtml.sh
+
+if [ ! -d "$AONDIR" ]; then
+ >&2 echo "Please set the AONDIR environment variable"
+ exit
+fi
+CURR_DIR=`pwd`
+
+book_db="$AONDIR/common/sqlite/bookcodes.db"
+
+for book in $@
+do
+ row=($(sqlite3 -separator ' ' $book_db "select lang, series from bookcodes where book = '$book';"))
+
+ lang=${row[0]}
+ series=${row[1]}
+
+ for format in xhtml xhtml-less-simple
+ do
+ source_dir="$AONDIR/$lang/$format/$series/$book"
+ output_dir="$CURR_DIR/$lang/$format/$series/$book"
+ mkdir -p "$output_dir"
+ cp -av "$source_dir"/* "$output_dir"
+ done
+
+ source_dir="$AONDIR/$lang/xhtml-simple/$series"
+ output_dir="$CURR_DIR/$lang/xhtml-simple/$series"
+ mkdir -p "$output_dir"
+ cp -av "$source_dir/$book".* "$output_dir"
+done
--- /dev/null
+#!/usr/bin/env bash
+#
+# List all bookcodes.
+
+if [ ! -d "$AONDIR" ]; then
+ >&2 echo "Please set the AONDIR environment variable"
+ exit
+fi
+
+book_db="$AONDIR/common/sqlite/bookcodes.db"
+
+sqlite3 -column -noheader "$book_db" "select book from bookcodes order by book"
--- /dev/null
+#!/usr/bin/env bash
+#
+# List all bookcodes that match given language.
+#
+# Example:
+# list-bookcodes-by-lang.sh en es
+
+if [ ! -d "$AONDIR" ]; then
+ >&2 echo "Please set the AONDIR environment variable"
+ exit
+fi
+
+book_db="$AONDIR/common/sqlite/bookcodes.db"
+
+for lang in $@
+do
+ if [[ ! $lang =~ ^[a-z][a-z]$ ]]; then
+ >&2 echo "invalid language"
+ exit
+ fi
+
+ sqlite3 -column -noheader "$book_db" <<EOF
+ select book
+ from bookcodes
+ where lang = '$lang'
+ order by book
+EOF
+done
--- /dev/null
+#!/usr/bin/env bash
+#
+# List all bookcodes that match given series.
+#
+# Example:
+# list-bookcodes-by-series.sh lw gs
+
+if [ ! -d "$AONDIR" ]; then
+ >&2 echo "Please set the AONDIR environment variable"
+ exit
+fi
+
+book_db="$AONDIR/common/sqlite/bookcodes.db"
+
+for series in $@
+do
+ if [[ ! $series =~ ^[a-z][a-z]$ ]]; then
+ >&2 echo "invalid series"
+ exit
+ fi
+
+ sqlite3 -column -noheader "$book_db" <<EOF
+ select book
+ from bookcodes
+ where series = '$series'
+ order by book
+EOF
+done