View Single Post
Old 04-06-2023, 08:51 PM   #1
haertig
Wizard
haertig ought to be getting tired of karma fortunes by now.haertig ought to be getting tired of karma fortunes by now.haertig ought to be getting tired of karma fortunes by now.haertig ought to be getting tired of karma fortunes by now.haertig ought to be getting tired of karma fortunes by now.haertig ought to be getting tired of karma fortunes by now.haertig ought to be getting tired of karma fortunes by now.haertig ought to be getting tired of karma fortunes by now.haertig ought to be getting tired of karma fortunes by now.haertig ought to be getting tired of karma fortunes by now.haertig ought to be getting tired of karma fortunes by now.
 
Posts: 1,899
Karma: 31522252
Join Date: Sep 2017
Device: PW3, Fire HD8 Gen7, Moto G7, Sansa Clip v2, Ruizu X26
Question on metadata plugboard

I like books to display on my Paperwhite library page as "Series - Index - Title"

e.g., "Sigma Force - 01 - Sandstorm" and "Sigma Force - 07 - The Devil Colony"

This is easily accomplished with the "Metadata Plugboard" set to something like this:
{series}{series_index:0>2s| - | - }{title}

But for some books, either the series name or the book title is too long, and the result of the above plugboard ends up being truncated by the Paperwhite firmware when it is displayed.

My first thought to fix this was to use the function shorten() in the plugboard to truncate the series name and add an ellipsis on the end. But the Calibre documentation days that you should not use a function in a plugboard template. Plus, sometimes it is the title of the book that is too long, not the series. Additionally, a blind truncation of a field with an added ellipsis is sometimes awkward looking. On top of all this, we would be looking at fairly complex plugboard expression to handle all this.

So my proposed solution is a custom column which contains the string to display on my Paperwhite. I'll call it Alt ID, with a lookup name of #altid. Now the plugboard only needs to look for the existence of data in the #altid column. If found, use that. If not found, use {series}{series_index:0>2s| - | - }{title}

And I would manually populate this custom column when I add a new book to Calibre. Most of the time I don't need to bother with this column. But if I notice an extremely long series name or book title, I can optionally populate the column.

e.g., Say I had Series = "Harry Potter" and Title = "Harry Potter and the Chamber of Secrets". I would manually populate the #altid column with "Harry Potter - 02 - Chamber of Secrets" (altering the book title to fit)

e.g., Say I had Series = "Nina Wilde and Eddie Chase" and Title = "The Hunt for Atlantis". I would manually populate #altid with "Nina Wilde - 01 - The Hunt for Atlantis". (Altering the series name to fit ... poor Eddie got left out!)

This solution seems workable given that MOST book titles/series names in my collection seem to fit on the Paperwhite display using the simple plugboard {series}{series_index:0>2s| - | - }{title} without having to worry about populating #altid.

I have to research how to specify the plugboard that I want. One that will select #altid if it exists, and if not, will default to use {series}{series_index:0>2s| - | - }{title}

I have not yet approached the specification of this plugboard. But it sounds like something I might be able to accomplish. I'll have to read up a little more on the plugboard language though.

Does anybody else have a different/simpler way to handle this problem? Or know off the top of their head the plugboard specification that I would need to use? I don't like the manual #altid approach really, nor do I like the programmatic approach because it's just too hard to find an appropriate abbreviation/truncation of a long test string via algorithms. A programmatic approach might end up with something strange like, e.g.,

"Nina Wilde and E... - 01 - The Hunt for Atla..."

So I'm thinking the manual specification approach may be the better of two evils, given that the manual population route would rarely be needed, for most books.

Thanks in advance for any feedback/advice/help!
haertig is offline   Reply With Quote