#!/bin/sh
TODAY=`date +"%Y%m%d"`
ROOTPATH=/calibre
RECIPEPATH=$ROOTPATH/recipe
MOBIPATH=/news
OPTIONS="--output-profile kindle_pw"
echo $RECIPEPATH
#
#
#  convert epub to mobi 
#
ebook-convert "$RECIPEPATH/oriental_daily_pure.recipe" $MOBIPATH/$TODAY-orient.mobi $OPTIONS
#
#
#  download news and save output to epub
#
#
ebook-convert $MOBIPATH/$TODAY-orient.mobi $MOBIPATH/$TODAY-orient.epub 
#
#
#  send book to kindle
#
calibre-smtp  --subject "oriental news $TODAY" --attachment $MOBIPATH/$TODAY-orient.epub --relay hwsmtp.exmail.qq.com --port 465 --username vortify-lc@algometic.com --password "adverS@1e" --encryption-method SSL vortify-lc@algometic.com larry1chan11@kindle.com ""
#calibre-smtp  --subject "oriental news $TODAY" --attachment $MOBIPATH/$TODAY-orient.epub --relay hwsmtp.exmail.qq.com --port 465 --username vortify-lc@algometic.com --password "ins@neS00n" --encryption-method SSL vortify-lc@algometic.com larry1chan11@kindle.com ""

#
#  rm mobi file
#
rm $MOBIPATH/$TODAY-orient.mobi
