upkindle.sh 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #!/bin/sh
  2. TZ=Asia/Hong_Kong
  3. TODAY=`date +"%Y%m%d"`
  4. ROOTPATH=/calibre
  5. RECIPEPATH=$ROOTPATH/recipe
  6. MOBIPATH=/news
  7. ARCHIVEPATH=/news
  8. OPTIONS="--output-profile kindle_pw"
  9. DROPPATH=/webdav
  10. echo $RECIPEPATH
  11. #
  12. #
  13. # convert epub to mobi
  14. #
  15. ebook-convert "$RECIPEPATH/oriental_daily_pure.recipe" $MOBIPATH/$TODAY-orient.mobi $OPTIONS
  16. #
  17. #
  18. # download news and save output to epub
  19. #
  20. #
  21. ebook-convert $MOBIPATH/$TODAY-orient.mobi $MOBIPATH/$TODAY-orient.epub
  22. #
  23. #
  24. # send book to kindle
  25. #
  26. #calibre-smtp --subject "oriental news $TODAY" --attachment $MOBIPATH/$TODAY-orient.epub --relay hwsmtp.exmail.qq.com --port 465 --username vortify-lc@algometic.com --password "samP@n?1" --encryption-method SSL vortify-lc@algometic.com larry1chan11@kindle.com ""
  27. #
  28. # commented out the next line instead use jailbroken koreader script to retrieve news (2026/8/8)
  29. # https://github.com/laxaurus/koreader-nextcloud-sync/blob/main/README.md
  30. #
  31. #calibre-smtp --subject "oriental news $TODAY" --attachment $MOBIPATH/$TODAY-orient.epub --relay smtp.qq.com --port 465 --username larry1chan@qq.com --password "xhybazbbucdyceed" --encryption-method SSL larry1chan@qq.com larry1chan11@kindle.com ""
  32. #
  33. #
  34. # drop epub to webdav location for kindle koreader to pull (2026/8/14)
  35. #
  36. #
  37. ls $DROPPATH
  38. cp $MOBIPATH/$TODAY-orient.epub $DROPPATH/NEWS_$TODAY-orient.epub
  39. chmod 777 $DROPPATH/NEWS_$TODAY-orient.epub
  40. #install -m 777 $MOBIPATH/$TODAY-orient.epub $WEBDAV_PATH/NEWS_$TODAY-orient.epub
  41. #
  42. # rm mobi file
  43. #
  44. rm $MOBIPATH/$TODAY-orient.mobi
  45. #
  46. # archive old epubs
  47. #
  48. for f in $(find "$MOBIPATH" -maxdepth 1 -name "????????-orient.epub" -mtime +30); do
  49. year=$(basename "$f" | cut -c1-4)
  50. mkdir -p "$ARCHIVEPATH/$year"
  51. mv "$f" "$ARCHIVEPATH/$year/"
  52. done