Calibre Synology



Jan 07, 2020 Calibre-Web is an eBook viewer which uses an existing Calibre database to pull content. We do not run the stand alone version of Calibre, but instead use a build of LazyLibrarian which has Calibre built in. Some of Calibre-web’s features include: Full HTML5 GUI. User management with per-user permissions; Custom shelves; Editing eBook metadata.

  1. Calibre Synology System
  2. Synology Calibre Without Docker
  3. Calibre Synology
  1. Calibre is a free ebook manager. It has been around for a while, has an e-book viewer, ability to share your library and a verbose plugin ecosystem. I have used Calibre for a few years on my desktop computer with great results and once I got a NAS I wanted to switch it over there.
  2. You can instead create an image with a Dockerfile which passes in sensitive arguments: Jan 07, 2020 Calibre-Web is an eBook viewer which uses an existing Calibre database to pull content. Com’ if there is no private registry mentioned in the ‘daemon. Restart the container using the full command above.

BicBucStriim streams books, digital books. It fills a gap in the functionality of current NAS devices, which provide access to your collection of music, videos and photos – but not books. BicBucStriim covers that area and provides web-based access to your e-book collection.

BicBucStriim was created when I bought a NAS device (Synology DS 512+) to store my media on it. NAS devices like the Synology DS typically include media servers that publish audio, video, photos, so that you can access your media from all kinds of devices (TV, smart phone, laptop …) inside the house, which I found very convenient. Unfortunately there was nothing like that for e-books. So I started to develop BicBucStriim.

BicBucStriim is a simple PHP application that runs in the Apache/PHP environment provided by the NAS (or any other server). It assumes that you manage your e-book collection with Calibre. The application reads the Calibre data and publishes it in HTML form. To access the e-book catalog you simply point your ebook reader to your NAS, select one of your e-books and download it.

Want to try it?

  • Install or upgrade

Problems? Ideas?

  • Troubleshooting is built-in
  • Different environment/server/setup? The Wiki might help.
  • Found an error? Have a suggestion? Report it on GitHub

Want to add, change it? Have a look at the code …

Status

BicBucStriim is still under development. Version 1.3:

  • is easy to install
  • shows the most recent titles on the index page
  • provides listing/filtering/searching for book titles, authors, tags and series
  • shows detail pages for authors and books (including download links and custom columns)
  • provides author pages that can be enriched with bio pics and links to related resources, like Blogs, Twitter etc
  • is ready for mobile clients
  • provides OPDS book catalogs for reading apps like Stanza (more)
  • speaks Dutch, English, French, German, Italian, Galician (some only partially)
  • has an admin GUI for configuration
  • supports e-mailing of books

New in version 1.3

  • switch between title- and time-based navigation for books
  • workarounds for QNAP devices with outdated/buggy SQLite libraries
  • added a library summary to the front page
  • slightly updated layout
  • replaced session and authentication handling

Features

BicBucStriim just displays what is stored in your Calibre library. The start page lists the most recent books in your library, assuming that they are new and therefore need to be read:

In addition to that the main menu shows four more ways to navigate through your library: by book title, author name, book tag or series name. All sections work in the same way, you either scroll through the listing or search by entering something in the search bar at the top.

Once a book is selected, the app shows a details page with title, author information, tags and series if available, and of course the book description. In the download section of that page there are download links for all book formats stored in the Calibre library. Click on a link and the book file will be immediately sent to your device.

If a book contains metadata like ISBN numbers, these can be easily converted automatically to links. Just define a template for it.

If your Calibre library contains custom columns they will be displayed here too, formatted as a table. The app will display all columns with values for the current book. However, composite custom columns are not supported!

Furthermore, it is now possible to add custom information about individual authors. Traditionally Calibre is focussed on books, the titles have detail pages and are visualized by their cover images. Authors existed only as names. BicBucStriim tries to chnage that and adds the possibilit to add metadata to authors. The author apges aren’t restricted anymore to listing the books for an author, but can also contain:

  • author image
  • links to blogs and other author-related web pages

The author information can be added by clicking on the black edit button in the top right corner of each author page. A menu provides then functions to add/delete an image or to edit the links on the page. Please note that these features are only available for the admin user.

Alternatives

BicBucStriim is intended for in-house usage, on a NAS or a similar device without much memory and processing power. On a PC you could simply use the Content Server built into Calibre.

If you are looking for a possibility to publish a larger book collection, or want to publish on the Internet, then calibre2opds might be interesting. It generates a static HTML catalog of a Calibre library that then can be transferred to a web server.

Requirements

  • Apache web server with PHP 5.3+ and sqlite3 support (other web servers possible, see Install)
  • Optional: if mcrypt (php5-mcrypt) is available, it will be used to encrypt cookies
  • Optional: if PHP module intl (php5-intl) is installed, book languages will be displayed
  • Optional: sending books by email requires PHP mail, sendmail or a SMTP account

Install

This procedure assumes that there is already a running Apache web server. For other cases please check the Webservers section of the wiki.

Calibre

The easy way assumes that BicBucStriim lives in a bbs folder right below the web root of your device and can be addressed like http://<your ip>/bbs/:

  1. Download the current installation archive.
  2. Unarchive the downloaded archive below the web server root of your NAS (e.g. “/volume1/web” on a Synology device)
  3. Rename the newly created directory (e.g. BicBucStriim-1.1.0) to “bbs”.
  4. The “data” directory and its contents must be writeable for all. Depending on your method of unarchiving this might be already the case. However, in case you experience access error just use a terminal to correct this: chmod -R ga+w data.
  5. Navigate to the main page: http://<address of your NAS>/bbs/.

A freshly installed BicBucStriim installation will show the login page. The initial login information for the administrator is

  • user name: admin
  • password : admin

After logging in, you will be redirected to the admin section, where you will have to tell the app where your Calibre library is located. Everything else is optional, but you should now also change the admin password.

On some NAS devices, like Synology, you also have to add the path of your Calibre library to the PHP open_basedir variable, if the library is located outside the web folder. For security reasons PHP can only access files in the web folder and in directories mentioned in the open_basedir variable. On a Synology device you can set this in the Control Panel: navigate to ‘Web Services’, ‘PHP Settings’. Add your Calibre library path to the end of open_basedir (and don’t forget to separate it with a colon – ‘:’ – from the other directories).

NOTE (for experienced users): You could also clone the Github repository, however that contains many files that are only useful during development. The installation archives contain onl the necessray files.

Tell BicBucStriim where your Calibre library lives

BicBucStriim needs to know where you Calibre library directory resides, the full path to the folder that contains your metadata.db and the book directories. In my case that is /volume1/books so I entered this path in the admin page.

That is all you need to do to get BicBucStriim running. Save and navigate to the start page. The index page should appear.

If the app can’t access the Calibre library it will tell you. BicBucStriim looks for a valid Calibre library directory with file metadata.db at the top. The most common problems are access errors. The app must be able to access the library. In case of problems you should adjust your access restrictions for the Calibre directory.

Optional: Decide if you need login protection

If you need to protect your library set the switch Login required to true. Then only authenticated users will be able to use it. Otherwise switch the login protection off, then everybody can access the library.

Please note: Some ebook readers, like older versions of the Tolino (with firmware version 1.9.4 it worked), can’t download ebooks while the login protection is in effect.

Optional: Add more users

If you want to share your library with your family you can add more user accounts for them.

Optional: Enable automatic linking with ID templates

Many books contain one or more IDs (see the Calibre field IDs). The most common ID is the ISBN number, others are from publishers or distributors. BicBucStriim detects these IDs and provides a mechanism to use these IDs to create links automatically.

The configuration page ID templates in the admin section lists all IDs in your library. By clicking on individual IDs you can add or edit link templates for the ID. A link template is simly a URL with the special marker %id that will be replaced by the value for that ID found in individual books.

To provide links for ISBNs in your books you could edit the link template by adding the URL http://isbnsearch.org/isbn/%id%. Once this template is saved every book with an ISBN ID will display automatically a clickable ISBN link in the ID links section of a book`s details page.

Using this mechanism you can easily provide links to other pages that contain information related to your books.

Optional: Send books via e-mail

If you can’t download books directly you could send them via e-mail to your device. If the Send-To-Kindle feature is activated an e-mail link will appear for each book with a Kindle-compatible format. This feature also needs a valid sender (From) address.

BicBucStriim supports multiple transport mechanisms for sending mails. Select the right one for your machine. Only if you want to send mails via SMTP additional configuration is necessary.

Optional: Change the look of thumbnails

By default BicBucStriim generates clipped thumbnails for books. That means it uses the largest possible square in the middle of the book cover. That way we get a small thummbnail that still shows enough details from the original cover image.

However, if you absoloutely need to see a true representation of the cover image, just set the switch Clip thumbnails? to No, and you will get it.

Optional: Change the page size

If you want to see more or less entries (books, authors, tags) per page, just change the number in Page size. Initially BicBucStriim uses 30 items per page.

Optional: Change the app title

If you want to change the title, e.g. to use the name of your library, you can do so by entering a new title in Alternative page title.

Optional: Change book metadata

Enable this setting if you want the book metadata to be updated when a book is downloaded. This is currently only possible for EPUB titles and overwrites the metadata stored in the book with the data stored in Calibre.

HTTP or HTTPS?

BicBucStriim doesn’t care about the protocol used. However, there are applications and devices that had problems when HTTPS was used. Please check

Examples:

  • older versions of Aldiko wouldn’t load thumbnails over HTTPS
  • Tolinos wouldn’t download ebooks over HTTPS

Upgrading

The database structure of version 1.2 is incompatible with previous versions, so exisiting users should start with a fresh install. However, if you have lots of books and don’t want to regenerate all the thumbnails for them:

  • Backup your old BicBucStriim installation, eg. mv bbs bbs.old
  • Install the new version and run it
  • There should be a new directory: bbs/data/titles
  • Copy the thumbnail files (thumb_*.png) from your old data directory to bbs/data/titles
  • Use chmod -R ga+w bbs/data/titles to correct the permissions after copying if there are access errors

Notice for users upgrading from v1.2.4 or earlier: since v1.2.5+ issue #104 added the possibility to have multiple admin users. If you have trouble to login as admin, either

  • use the sqlite3 cli to update user set role=1 where username='admin';
  • delete data/data.db

Troubleshooting

If you encounter problems, use the installation test to check your environment. Invoke this test by navigating to http://<NAS address>/bbs/installcheck.php. This test checks for problems that users experienced in the past.

The installation test has two main parts

  • the library access check
  • the environment test

The environment part (labeled Environment Checks) tests the technical requirements and various sources for errors that appeared in the past. The test results are signalled in traffic light fashion:

  • green: everything is ok
  • yellow: there could be a problem – you should check the description. Click on the corresponding info button.
  • red: there is definetively a problem. Click on the corresponding info button fr a description.

The second part, the Calibre library check, simply tests whether your library is accessible by a web application. Many NAS devices restrict the access of web applications to certain directories, a security precaution. So if BicBucStriim can’t load your books, simply enter the directory where your books are stored in the Calibre library check form and test it.

Calibre Synology System

For Synology users: if you experience strange errors after installation/upgrade, e.g. blank pages or messages about classes not found, then simply reboot your device or restart the web server (/usr/syno/etc/rc.d/S97apache-user.sh restart) manually. This helps in most cases.

If the problem doesn’t go away, just let me know.

OPDS catalogs

Starting with version 0.9 BicBucStriim provides OPDS catalogs for reading apps like Stanza or Aldiko. The main entry point for these catalogs is http://.../bbs/opds/.

At this stage the OPDS support provides the usual hierarchy for browsing your library by book title, author, tag or series. Searching is not yet possible.

Synology Calibre Without Docker

NOTE: if you are using OPDS via HTTPS to access there could be a problem with the download of images. Aldiko, for example, doesn’t load images with a HTTPS address.

License

BicBucStriim itself is licensed under the MIT license, for the licenses of the libraries used see the file NOTICE.

Is brilliant! I thought the last update I made to Calibre Server (from 2.something to 3.8) was good, and I blogged about it (a little) here, but Calibre-web is a whole new gravy!

Calibre 2 was pretty basic and allowed you to read books and download them to a capable device, which was my use-case. I have a Kindle Voyager and wanted a wireless solution to put my own books onto the Amazon device. It meant using the Experimental Browser on the Kindle, but it worked fine and meant no wires were required.

The upgrade to 3.8 added a much slicker interface, that allowed metadata to be edited, cover art to be displayed nicely, and multi-user, although this was not through the GUI. It was a much nicer experience, but functionally pretty similar.

Calibre-web is a completely different solution, although uses the database and library from Calibre. I don’t think you even need Calibre running, once you have the database file? I’ve actually got it running for now in a Docker container but may look to move that to a jail at some point.

Calibre-web adds pretty much all of the functionality from the desktop Calibre app that was missing from the server, the bigs ones for me being:

  • User management with fine-grained per-user permissions (including public registration if required)
  • Create a custom book collection (shelves)
  • Support for converting eBooks through Calibre binaries
  • Send eBooks to Kindle devices with the click of a button
  • Upload new books in many formats

The ability to convert books (say from a .epub to a .mobi format) and the to be able to send them straight to a Kindle at the click of a button is massive. You can upload books in Calibre Server, but not being able to convert them pretty much meant you need to add them through the Desktop. In theory, everything can now be done via Calibre-web, or at least everything I use it for.

I need to see how it works when I sync my library from my iMac to FreeNAS0, but from what I can tell it uses its own database for Calibre-web functionality (e.g. Users, custom book collections, etc.) so should work together without issue.

Calibre Synology

So far, it’s a real game-changer and may even result in me using Calibre entirely through Calibre-web moving forward.