Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Related Tools

Notices

Reply
 
Thread Tools Search this Thread
Old 09-25-2011, 07:41 AM   #1
aruangra
Connoisseur
aruangra has learned how to read e-booksaruangra has learned how to read e-booksaruangra has learned how to read e-booksaruangra has learned how to read e-booksaruangra has learned how to read e-booksaruangra has learned how to read e-booksaruangra has learned how to read e-books
 
Posts: 83
Karma: 888
Join Date: May 2010
Device: Nook Touch, iPad1, iPad2, iPod Touch 4G, Pixel Qi
[How To] Calibre on Android e-Reader (Nook Touch)

I installed Calibre on my Nook Touch to fetch news and serve contents to reader programs in the device. The method can be used with other Android readers. In summary, Calibre is installed in Debian 6.0.0 chroot environment for an ARM-based CPU. The steps are as follows:

1. Prepare a Debian 6.0.0 package for an ARM-based CPU using this command in a PC with Debian 6.0.0:

Code:
debootstrap --arch armel --foreign squeeze debian --verbose http://ftp.debian.org/debian
You can download the package from http://www.4shared.com/file/RRuFfjRf/debiantar.html
and uncompress to the folder “debian”

2. Make an EXT2 partition on an SD card. The partition size should be larger than 1 GB. On a Windows PC, you may use MiniTool Partition Wizard Home Edition but the second partition cannot be shown. You may need to use a Live CD or a virtual machine to copy the debian package (in Step 1) to the new partition.

3. Connect to shell in the device

Code:
adb connect 192.168.XXX.XXX
adb shell
4. Mount partition of the SD card to a directory. In my case, I use /data/local/mnt. Note that my partition is at /dev/block/vold/179:21. You may need to find your partition by trial-and-error.
Code:
cd /data/local/
mkdir mnt
mount -t ext2 -o noatime /dev/block/vold/179:21 /data/local/mnt
5. Setup the chroot environment

Code:
cd /data/local/mnt
chroot debian /bin/bash
export PATH=/usr/bin:/usr/sbin:/bin:$PATH
export TERM=linux
export HOME=/root
export USER=root
mount -t devpts devpts /dev/pts
mount -t proc proc /proc
mount -t sysfs sysfs /sys
/debootstrap/debootstrap --second-stage
echo 'nameserver 4.2.2.2' > /etc/resolv.conf
echo 'deb http://ftp.debian.org/debian squeeze main' > /etc/apt/sources.list
apt-get update
6. Install calibre 0.7.7 (larger than 400 MB). The program is installed to /usr/share/calibre/
Code:
apt-get install calibre 
apt-get install python-routes
7. Set environment variables in .bashrc
7.1 Exit to DOS prompt
7.2 Copy .bashrc to the local PC.

Code:
adb pull /data/local/mnt/debian/root/.bashrc
7.3 Add the following commands to .bashrc

Code:
export LANG=en_US.UTF-8
export TZ=Asia/Bangkok
export PATH=/usr/bin:/usr/sbin:/bin:$PATH
export TERM=linux
export HOME=/root
export USER=root
7.4 Send .bashrc to the device

Code:
adb push .bashrc /data/local/mnt/debian/root/
8. Enter the chroot environment to use Calibre

Code:
cd /data/local/mnt
chroot debian /bin/bash
Some key commands are as follows: (My epup files are in /usr/share/calibre/serve/)

Code:
ebook-convert /usr/share/calibre/recipes/nasa.recipe /usr/share/calibre/serve/nasa.epub
calibredb add --duplicates --with-library /var/www/ /usr/share/calibre/serve/nasa.epub
calibre-server --with-library /var/www/ --daemonize
9. Scheduling news fetching
I use APScheduler:
http://packages.python.org/APScheduler/
My script (script.py) can be downloaded from
http://www.mediafire.com/?to23i9339ivx1p9
Code:
import os
import time
from apscheduler.scheduler import Scheduler
# Start the scheduler
sched = Scheduler()
sched.start()
def job_function1():
   os.system("ebook-convert /usr/share/calibre/recipes/thairath.recipe /usr/share/calibre/serve/thairath%20news.epub")
   os.system("ebook-convert /usr/share/calibre/recipes/cnn.recipe /usr/share/calibre/serve/cnn.epub")
   os.system("calibredb add --duplicates --with-library /var/www/ /usr/share/calibre/serve/cnn.epub")
# Schedule
sched.add_cron_job(job_function1, day_of_week='mon-sun', hour=4, minute=0)
while True:
   time.sleep(10)
To run the script, use this command:

Code:
nohup python script.py &
10. There are several ways to access epub files to use in Aldiko or other readers for Android
- calibre server
- lighttpd webserver
- mounting the directory in the chroot to the SD card

Code:
mount -o bind /data/local/mnt/debian/usr/share/calibre/serve/ /sdcard/eBooks/Calibre
In Aldiko, epub files can be accessed from /sdcard/eBooks/Calibre.

11. Control Wifi on-off
You can use Taskbomb or Tasker to control Wifi to save the battery life.

12. When rebooting your device, you will need to input these commands:
Code:
mount -t ext2 -o noatime /dev/block/vold/179:21 /data/local/mnt
mount -o bind /data/local/mnt/debian/usr/share/calibre/serve/ /sdcard/eBooks/Calibre
cd /data/local/mnt
chroot debian /bin/bash
mount -t devpts devpts /dev/pts
mount -t proc proc /proc
mount -t sysfs sysfs /sys
nohup python /opt/script.py &
References
http://kristof.vanhertum.be/?p=132
http://www.nslu2-linux.org/wiki/DS101/Debian
http://evilzone.org/android/debian-on-android/
http://www.saurik.com/id/10
http://packages.python.org/APScheduler/
http://www.read.in.th/node/1164

Last edited by aruangra; 09-25-2011 at 07:43 AM.
aruangra is offline   Reply With Quote
Old 09-25-2011, 07:49 AM   #2
Manichean
Wizard
Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.
 
Manichean's Avatar
 
Posts: 3,130
Karma: 91256
Join Date: Feb 2008
Location: Germany
Device: Cybook Gen3
Moderator Notice
Moved to devices subforum.
Manichean is offline   Reply With Quote
Advert
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Nook Touch/Calibre wireless connection? tigersfan Devices 8 01-10-2012 02:51 PM
Error when running Calibre on Nook Touch aruangra Calibre 4 09-22-2011 11:01 PM
Calibre breaking Nook Touch hyphenation? jclim00 Calibre 8 09-04-2011 06:28 PM
Nook Touch is eink Android device Dopedangel Android Devices 2 08-03-2011 02:40 PM
Touch Android app on rooted NOOK touch el34han Nook Developer's Corner 0 06-24-2011 10:16 AM


All times are GMT -4. The time now is 07:18 AM.


MobileRead.com is a privately owned, operated and funded community.