Make it possible to generate 29tsoc ebooks
[project-aon.git] / common / scripts / copy-svg.sh
index f2b7e08..532af7c 100755 (executable)
 
 if [ ! -d "$AONDIR" ]; then
     >&2 echo "Please set the AONDIR environment variable"
-    exit
+    exit 1
 fi
 CURR_DIR=`pwd`
 
-book_db="$AONDIR/common/sqlite/bookcodes.db"
+if [ "$AONDIR" -ef "$CURR_DIR" ]; then
+    >&2 echo "Current directory is the same as AONDIR: giving up"
+    exit 1
+fi
 
 for book in $@
 do
-    row=($(sqlite3 -separator ' ' $book_db "select lang, series from bookcodes where book = '$book';"))
+    row=( $($AONDIR/common/scripts/list-book-info.sh $book) )
 
-    lang=${row[0]}
-    series=${row[1]}
+    lang=${row[1]}
+    series=${row[2]}
 
     source_dir="$AONDIR/$lang/svg/$series"
     output_dir="$CURR_DIR/$lang/svg/$series"