Skip to content

CalibreSync Development Notes

Pasted image 20230328200927.png

CalibreSync is an iOS extension which allows you to browse your Calibre library from the Files application on your iPhone and iPad.


Development Environment Setup

Install Cocoapods

Follow Cocoapod installation instructions here: Ruby Cheatsheet

Build Project

# Checkout codebase
git clone git@github.com:peddamat/CalibreSync3.git CalibreSync

# Install deps
pod install

# Open workspace
open CalibreSync3.xcworkspace

Pasted image 20230328201528.png

Hit CMD+B to build the project.


Components

The extension consists of three parts:

  • CalibreSync
    • The main application allows users to configure CalibreSync by selecting one of the following:
      • URL for Calibre feed
      • Location of Calibre database
  • CalibreSyncExtension
    • The extension does the following:
      • Adds 'CalibreSync' to the Locations menu in the Files app
  • CalibreSyncExtensionUI
    • Displays the downloaded Calibre library in the Files app

Features

  • Download and load Calibre database
    • Mount SMB fileshare
    • Locate metadata.db
    • Parse metadata.db using SQLite
    • Cache metadata.db for offline usage
  • Display book covers from Calibre database
    • Download and cache covers for offline usage
  • Download books from Calibre database
  • Edit book metadata
    • Resync metadata with SMB database
  • Create Book model
  • Create BookList view
  • Create BookDetail view
  • Create button to load Fileshare

Architecture

How books are loaded from Calibre Library

  • The user selects the directory containing the Calibre Database
    • Check for existence of metadata.db in the root of this directory
    • Load Calibre database from metadata.db
  • The 'Books' table contains the following relevant fields:
    • id
    • title
    • pubdate
    • author_sort
    • path
    • has_cover
  • The 'Data' table contains the available formats for each book in the 'Books' table, and contains the following relevant fields:
    • name
  • The detailed metadata associated with each book is contained in the metadata.opf XML file stored in each Book's 'path'

Next Steps

  • Copy example Calibre database to project and load book entries
    • Create Record stubs for Calibre book entries
    • Load Calibre database and print out all book titles
  • Display book covers in waterfall grid
  • Load Calibre database from file share
  • Load .epub from fileshare
  • Refactor CalibreSync v1 code to allow loading of Calibre Database from fileshare
  • Implement infinite scrolling to load subsequent books in grid view
  • Implement book cover caching
  • Implement GRDB Scope Adapters to allow retrieving both the full database and initial set of books for main screen
  • Implement download folder scanning
  • Implement PDFExpert-like SMB connection workflow

References

Testing

Architecture

Database

Uncategorized

Todo


Last update: 2023-03-28