2.6 KiB
KOReaderServerFetcher
A simple setup to push books from your computer to your e-reader. Hit a button on your Kindle/Kobo, get your books just that easy.
What This Does
- Server: Python HTTP server that serves files from a folder and archives them after sending
- Plugin: KOReader plugin that fetches those files with one tap
Setup
Server Side
-
Put
server.pysomewhere on your computer -
Create a config at the top of the file:
- Set
AUTH_TOKENto something secret - Set
SOURCE_DIRto where you drop books (e.g.,/home/you/books/inbox) - Set
ARCHIVE_DIRto where served books go (e.g.,/home/you/books/sent)
- Set
-
Run it:
python3 server.py -
(Optional) Make it a service so it starts automatically:
sudo cp file-server.service /etc/systemd/system/ # Edit the file to fix paths and username sudo systemctl enable file-server sudo systemctl start file-server
KOReader Plugin
-
Copy the plugin folder to your device:
koreader/plugins/fetch.koplugin/ ├── main.lua └── config.lua -
Edit
config.lua:return { server_url = "http://your-server:8000/get", auth_token = "your-secret-token-here" } -
Restart KOReader
Usage
- Drop books into your server's inbox folder
- On your e-reader: Menu → Fetch Files → Fetch Now
- Books appear in your configured directory
First time setup: go to Menu → Fetch Files → Configure Home Directory to pick where books should go.
How It Works
The server zips up everything in the source folder and sends it over. After sending, it moves those files to the archive folder so you don't get duplicates next time.
The plugin downloads the zip, extracts it, and cleans up after itself.
Nginx Setup
If you want to access this over the internet, put it behind nginx with SSL:
location /get {
proxy_pass http://localhost:8000;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
}
Troubleshooting
Plugin doesn't show up: Check KOReader's crash.log
Can't connect to server: Make sure the URL in config.lua is correct and the server is running
Authentication failed: Token mismatch between server.py and config.lua
Files not extracting: The plugin needs unzip available on your device (it usually is)
Server logs wrong IP: Make sure nginx is forwarding the X-Forwarded-For header
Requirements
- Python 3.6+
- KOReader
unzipcommand on your e-reader (standard on most devices)
License
Do whatever you want with this.