View Single Post
Old 02-23-2026, 04:06 PM   #8
JimmXinu
Plugin Developer
JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.
 
JimmXinu's Avatar
 
Posts: 7,306
Karma: 5007213
Join Date: Dec 2011
Location: Midwest USA
Device: Kobo Clara Colour running KOReader
I'll be honest, I'm only looking at catalog as a crude possible replacement for Calibre Sync. (Look up story in catalog, note author & title, manually find in library dir.)

Given the limitations, and my more general lack of interest in catalog, I may never do anything with this. But here are a few notes of interest I've found:


First important note: Create Catalog's template does not use Calibre's templating language. It uses Python's string format system with a fixed dictionary of possible values.

thiago.eec's changes allow for custom columns by adding the custom columns directly to that dictionary.

But, as Kovid pointed out, it's technically invalid to use '{#column}' replacements (in format strings '#' is illegal in 'identifier'). But they work. For now. I'm sure the Python3 people will break it at some point.


Second important note: The catalog template.xhtml file is general to a Calibre install, while custom columns are library specific.

So code to allow custom columns in template.xhtml should allow for those columns to be missing in the current library.

I've identified a couple ways to do that:
  1. Suggested by this stackoverflow, add a 'cust' key to a defaultdict() of cust columns to use '{cust[#wordcount]}' instead of just '{#wordcount}'. Also solves '#' in identifier issue.
  2. Change args to defaultdict(str) and .format(**args) to .format_map(args). Still needs solution for '#' in identifier issue.
JimmXinu is offline   Reply With Quote