Home

Awesome

wincalibre2jellyfin

Python script to construct a Jellyfin ebook library from a Calibre library.

Windows

<em>(The Linux version of this script is maintained as a separate project. Please see calibre2jellyfin).</em>

Overview

Example author/series/book structure

Example assumes script has been configured to prefer .epub types over .azw and .mobi.

<table> <thead> <tr><th>Calibre store</th><th>Created Jellyfin store</th></tr> </thead> <tbody> <tr> <td><pre> └── Author\ └── Book A\ │ ├── cover.jpg │ ├── metadata.opf │ ├── Book A.azw │ └── Book A.epub ├── Book B\ │ ├── cover.jpg │ ├── metadata.opf │ ├── Book B.mobi │ └── Book B.epub </pre> </td> <td><pre> └── Author\ └── Lorem ipsum dolor sit amet Series\ ├── 001 - Book A\ │ ├── cover.jpg <- copy │ ├── metadata.opf <- modified copy │ └── Book A.epub <- copy ├── 002 - Book B\ │ ├── cover.jpg <- copy │ ├── metadata.opf <- modified copy │ └── Book B.epub <- copy </pre> </td> </tr> </tbody> </table> Jellyfin will display a drillable folder structure similarly to the way it does for movies, shows, and music. Jellyfin will extract, display, and sort by the mangled book title that is prepended with the series index.

Example series/book structure

The "series/book" option is intended for use with eComics, thanks for this go to Cudail.

<table> <thead> <tr><th>Calibre store</th><th>Created Jellyfin store</th></tr> </thead> <tbody> <tr> <td><pre> └── Author M\ └── Comic A\ ├── cover.jpg ├── metadata.opf └── Comic A.cbz └── Author N\ └── Comic B\ ├── cover.jpg ├── metadata.opf └── Comic B.cbz </pre> </td> <td><pre> └── Lorem ipsum dolor sit amet Series/ ├── 001 - Comic A\ │ ├── cover.jpg <- symlink │ ├── metadata.opf <- modified copy │ └── Comic A.cbz <- symlink ├── 002 - Comic B\ │ ├── cover.jpg <- symlink │ ├── metadata.opf <- modified copy │ └── Comic B.cbz <- symlink </pre> </td> </tr> </tbody> </table>

Changes

Dependencies

Installation

  1. In your browser navigate to "https://github.com/shawn61cp/wincalibre2jellyfin"
  2. Click the green "Code" button
  3. In the resulting dropdown, just over halfway down, find and click on "Download ZIP".
  4. Save the zip file somewhere convenient, your Documents folder is suggested, and extract it. We will call this EXTRACT_FOLDER.

Usage

Upgrading

Two things need to be accomplished:

  1. Replace your current script, wherever it was originally installed, with the new one.
    • This can be done basically by following the installation steps but you may need to extract the new zip file to a location other than the one you used originally in order to ensure that your existing configuration is not destroyed. Once the new zip file is extracted safely, you can copy only the new script over the top of the original script.
  2. Add any new config options to your existing configuration file.
    • This can be done by copying and pasting any new configuration parameters from the new sample configuration into your current configuration, or even just editing your current configuration. New configuration options are listed in the Changes section and also in the sample .cfg file.

Command line options

<pre> usage: calibre2jellyfin.py [-h] [--update-all-metadata] A utility to construct a Jellyfin ebook library from a Calibre library. Configuration file "/home/shawn/.config/calibre2jellyfin.cfg" is required. options: -h, --help show this help message and exit --update-all-metadata Useful to force a one-time update of all metadata files, for instance when configurable metadata mangling options have changed. (Normally metadata files are only updated when missing or out-of-date.) </pre>

Calibre Author Folders

Typically the Calibre author folder is named exactly as the author appears in the Calibre interface. Occasionally however it is not. I have seen this when Calibre displays authors as "Jane Doe & John Q. Public" but the folder name is actually just "Jane Doe". Also when the list of authors is very long, as happens in technical books, Calibre will limit the length of the folder name.

If you find that an expected author does not show up in the created Jellyfin library, double check that the author as listed in the .cfg file matches the actual folder name in the Calibre library.

Another thing I have encountered is when multiple versions of the author name exist, such as "Public, John Q." and "John Q. Public", and they are then consolidated, Calibre actually moves the books into the folder matching the consolidated name. If the author name configured for calibre2jellyfin happened to match the author name that "went away", updates to that author's books may appear to die, or you might see two different versions of the same author in Jellyfin. The solution is to just delete, in Jellyfin, one or both authors, ensure that the author configured in the .cfg file matches the Calibre author folder, then re-run the script to have them cleanly re-created. Jellyfin will eventually detect the changes and update the display contents. You can also right-click on an item within Jellyfin and request an immediate metadata refresh. Even so sometimes it will take a few minutes for Jellyfin to recognize the changes.

Odds and Ends