I know that we have a guide for Readarr and Calibre already, however I took a different approach to eBooks. I already had LazyLibrarian, Calibre, and Calibre Web up and running, but my setup was not very automated and I wanted to fix that. Outside of searching for and adding the book to LazyLibrarian, the rest of the process is automated when it comes to having the ebook downloaded, added to Calibre, and having it show up in Calibre Web. At that point you will have to take some other manual steps to get it onto your preferred reading device, but this takes out a lot of the guesswork of getting the actual book.
For the purpose of this guide we are going to be using the following Docker containers:
linuxserver/lazylibrarian
/linuxserver/calibre/
/linuxserver/calibre-web/
Here are the configurations you will need for each container:
LazyLibrarian
Path Mappings
/config <–> /appdata/lazylibrarian (or wherever your usual config folders are kept)
/downloads <–> /downloads/completed/books (or wherever you would like your book downloads to go, I use the same location for my Usenet downloads)
/books <–> /media/books/ (or wherever your Calibre library is)
Variable
ADD AN EXTRA Variable to docker config:
Name: CalibreMod
Key: DOCKER_MODS
Value: linuxserver/calibre-web:calibre
Description: optional - Adds the ability to enable the Calibredb import program
Calibre
Note - when using this container the template will require that you create a username and password. The password should be in MD5, so you can use https://www.md5hashgenerator.com/ to create the hash for your password
Path Mappings
/books <–> /media/books/ (should match what you entered for LazyLibrarian)
/import <–> /downloads/completed/books/ (should match the /downloads mapping from LazyLibrarian)
/config <–> /appdata/calibre (or wherever your usual config folders are kept)
Calibre Web
Path Mappings
/books <–> /media/books/ (should match what you entered for the other two containers)
/config <–> /appdata/calibre-web (or wherever your usual config folders are kept)
CALIBRE CONFIGURATION
At this point you should now have all three containers up and working so now it’s time to get everything configured. Since everything is predicated on the Calibre libary, let’s start with Calibre. When you first access Calibre, it will walk you through a welcome wizard. You can use this to create a new library or connect to an existing one.
On the first page of the wizard, make sure you select /books as the location for your library, and hit the “Next” button:
On the second page, unless you want to select a device, you can just hit “Next” here:
And on the final page you can just hit “Finish” to complete the wizard:
Now that your library has been created, there is one other thing to do inside of Calibre. Since most people will be sending books to their Kindle app or device, we want to make sure all .epubs that come in are converted to .mobi.
Click the “Preferences” button:
Click on “Behavior”:
Change the preferred output format to MOBI and click the “Apply” button:
Click on “Adding books”:
Click on the “Adding actions” tab:
Check the automatically convert box and then click the “Apply” button:
At this point, Calibre is configured and ready to go.
LAZYLIBRARIAN CONFIGURATION
Now we want to be able to get books into our Calibre library. You can tweak LazyLibrarian however you would like, these settings are going to make sure downloads are mostly automated.
Click on the “Config” tab:
On the “Interface” tab we need to set a specific user agent to ensure that LibGen does not block us from attempting searches and downloads. The user agent is:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36
Add that to the “User Agent” field. We also want to uncheck the box for “Show AudioBooks”. This will stop LazyLibrarian from adding audiobooks to be searched when adding a new book. Once these changes have been made, click the “Save changes” button.
Next, click on the “Providers” tab:
Scroll to the bottom to the “Direct Download Providers” section. Check the boxes to enable ZLibrary and LibGen. Also make sure the server for LibGen is libgen.rs. After the changes are made, scroll to the top of the page and click the “Save changes” button:
Next, click on the “Processing” tab:
In the “Intervals” section, change the Book Search and Post-Processing intervals to whatever your preference is. As you can see, both of mine are set to 2 minutes:
In the “Folders” section, make sure your directories are set as in the screenshot below (I don’t use LazyLibarian for AudioBooks so that folder setting has no effect on me, YMMV):
In the “External Programs” section, make sure the following are set for ebook-convert and Calibredb import (Calibredb is most likely /opt/calibre/calibredb and will need to be changed to /usr/bin/calibredb):
You can click the test buttons on each one of those to make sure you receive no errors. Once you have completed your changes, scroll to the top and click the “Save changes” button.
Those should be all of the changes for LazyLibrarian
CALIBRE WEB CONFIGURATION
The required configuration for Calibre Web is fairly small depending on your use case. The basic change that is required in the application is to point it to your Calibre library.
Click on the “Admin” link:
In the “Configuration” section, click on the “Edit Basic Configuration” button:
Change your Library Configuration to point to /books:
For my use case, I also allow my users to email books to their Kindle E-mail address. If you would like to do the same, you can add e-mail server settings in the “Admin” section as well:
Users will then need to edit their profile and add their Kindle email address so they can then email the book to their Kindle email to have it show on their device/app. When opening a book, they will have an option to email it:
Now that you have everything configured, you can add a book. On the home page of LazyLibrarian there is a box on the right to search for books:
Once the search is complete you can add the book by clicking the “Add Book” button:
Once you have added the book, if you want you can check the logs to make sure everything is working. Click on the “Logs” tab at the top of the page:
You can change the refresh rate to 5 seconds so you don’t have to refresh the page yourself:
You can see that LazyLibrarian was able to search the two providers and found a match. ZLibrary will sometimes block your IP for too many searches (as you can see in my screenshot) however the book was found on LibGen:
It took a couple of attempts and failed downloading the first book it found, but the download eventually completed:
After the download completed, the post-processor ran and imported the book into the Calibre library:
And the book now shows in Calibre Web where it can be downloaded or sent to Kindle:
The last thing to be done is we need to refresh the Calibre UI so that the new book will show. Because we are using calibredb outside of Calibre to update the database, the UI will not automatically pick up new books that have been added.
In Calibre, click on the down arrow to the right of “books” (or whatever your library is named):
Then go to Library maintenance => Check library
You will receive a success window you can just click the “No” button on:
And you can see the new book is now added at the top of the list:
Note - I did speak with the LazyLibrarian developer and there is no elegant solution to be able to have the Calibre UI update automatically when new books are added. I asked about having LazyLibrarian download books into a flat directory that Calibre could watch, however if you are downloading multiple books it will cause issues with the Calibre import. Here was their response:
LL puts each book into a subfolder as calibre uses “metadata.opf” and “cover.jpg” as filenames (LL uses book title). If there are multiple books in the folder waiting for calibre to import them, which book does “metadata.opf” belong to, and where is the metadata for the other books…
Works ok if there is only one book imported at a time, but if LL downloads several and calibre doesn’t notice quick enough you hit problems. Also there is a race condition where calibre notices there is a book to import, LL is still updating the folder at the time, and the import fails.