Sideloading EPUB files using Python SimpleHTTPServer
RSS • Permalink • Created 02 Jun 2014 • Written by Alberto Pettarin
I often need to sideload EPUB eBooks to Menestrello (or iBooks), on both iOS and Android devices. However, my preferred machines run Debian: booting the Mac Mini just to use iTunes, or even connecting the USB cable, would be really annoying. The same goes for using Dropbox or similar services.
Fortunately, there is a better option. To sideload my EPUB files, I instantiate a light HTTP request handler (Python SimpleHTTPServer) on my Debian machine, serving the directory where the EPUB file I want to sideload is, and downloading it onto the device using a Web browser.
It sounds complicated, but actually it is just as simple as issuing the command:
It will respond the following:
Now open a browser (e.g., Safari on iOS),
and point it to http://192.168.0.4:8000
(replace 192.168.0.4
with the local IP of your PC).
You will see something like this:
Click/tap on the link to the EPUB file to download it. On your console a log of the HTTP requests will appear:
In the above example, 192.168.0.7
is the local IP of my iPad,
and jerome01.epub
is the name of the file being downloaded.
At the end of the file transfer, just select the app to sideload the EPUB file to:
Once you are done, just hit CTRL+C
to terminate the SimpleHTTPServer
.
Note: you can replace 8000
with the port number of your choice.
Make sure your LAN/firewall settings allow HTTP traffic through it.
For the lazy: creating a Bash alias
Remembering the correct syntax (python -m SimpleHTTPServer 8000
) is annoying,
so a better solution consists in defining an easy-to-remember Bash alias,
for example sideload
.
My .bashrc
has the following:
The hostname -I
reminds me of the local IP of the current machine.
Once you setup this alias, all you need to do to sideload your EPUB files is: