Close

User-Defined Book Servers

A project log for FLOSS Book Serving System

An open-source ereader that can display books from an open, self-hosted server

guyrandy-jean-gillesGuyrandy Jean-Gilles 01/31/2024 at 02:030 Comments

Happy New Year! I didn't work on this project much during the holidays and I realized I've had at least one project update a month since keeping this log. So I thought I'd put together what I've been working on. This will entirely be a software update and, as of writing this, the code is still in the development branch because it's not the cleanest implementation, but it's functional.

New UI Elements

If you're new to the project, you'll know one of the goals is to allow a book lover to connect their eReader to any book server of their choosing. Before the most recent code changes, book lovers had to hand edit a line of Python code.

def __init__(self, url: str = "http://192.168.1.193:8080/opds"):

The url argument was hard-coded. There are multiple problems with this. First, a book lover has no way of knowing where to make this edit without reading source code. Second, there is no way to change the url through the UI. Third, only one server can be connected to.

Recent code changes added a status bar to the UI that has one option in the settings menu: Add Book Server.

The settings icon is an intuitive UI element and the "Add Book Server" menu option is self-explanatory; much less obtuse than editing the Python code above. The form to add a book server is... less aesthetic.

I'm not a graphic designer, but the form is functional and adds the book server to a list of urls in a file at $XDG_CONFIG_HOME/piereader/config.json. The config file looks like this:

{
    "book_directory": "/home/ereader/Bookshelf/",
    "bookservers": [
        "http://192.168.1.193:8080/opds",
        "mybookserverdomain.com"
    ]
}

For context, it took me 3 minutes to type http://192.168.1.193:8080/opdsusing the virtual keyboard and that was with partial refresh enabled. A tech savvy book lover would be better off ssh-ing into the device and editing the above file, but if that's not an option, now there is a way to do it through the UI.

Right now, only Calibre servers are implemented, but more server types will be added in the future.

Under The Hood

Except for the Python code mentioned above, the entire project is written in C. The new server form calls the Python code to download books and access the book servers. Both the C and Python had to be refactored to accommodate for this communication. I won't say the implementation is good. In fact, I think this portion of the project should be refactored for better data flow. I really didn't plan out the system architecture at all as I was focused on connecting the book rendering libraries to the GUI framework and the ePaper driver.

Right now, there is a five second timer that checks if there are un-downloaded books available from the known list of servers. Again, the messages sent between the UI elements and between C and Python are not the cleanest. But it's functional and there's a long list of tasks to work on.

Next steps

Now that there's a status bar and virtual keyboard, I can add things like a clock, WiFI entry, battery status, power settings, etc. That said, I've made a habit of working on software as PCBs are manufactured since that's an effective use of lead times. The hardware changes in the backlog are:

  1. Adding audio
  2. Switching to a ePaper with more grayscale bits
  3. Making a custom Linux board/moving to a micro-controller

There's a hard blocker for adding audio since using PWM (which dims the back-light) with the bcm2835 library requires turning audio off. I'll have to control the back-light with the proprietary serial protocol of the TPS61165. I still have yet to trouble shoot the back-light not dimming, but the development boards have come in so I can move forward there.

Drastic hardware changes like moving away from the Raspberry Pi or to a micro-controller would be fun but wouldn't add a lot to the project that can't be done with current hardware. Adding audio opens the project up to audio books and podcasts and using a display with at least 4 levels of gray would open up the project to comics and manga.

For now I'll be writing software for inputting WiFI credentials, but the future of the project's hardware is still in flux.

For the latest hardware and firmware updates, please see the project's repository.

Discussions