![]() |
#1 |
Library Breeder (She/Her)
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,268
Karma: 1937891
Join Date: Apr 2015
Location: Fullerton, California
Device: Paperwhite 2015 (2), PW 2024 (12 GEN), PW 2023 (11 GEN), Scribe (1st)
|
Custom Column for Cover Size
I have been searching all over to figure this out, even used Open AI, and it keeps giving me the wrong answer.
How do I create a custom column that has the cover size in a format like it's shown in the book details? My send to Kindle covers are not showing up in some devices and I want to make sure I also have the best size for showing on my scribe. I know the plugin for Quality check looks for covers of a specific size, but I just want a column to look over quickly. Please and thank you for any help ![]() |
![]() |
![]() |
![]() |
#2 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,447
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
There is no existing built-in way to get the cover size. It can be done in a python template but that requires opening the cover to compute its size, which could be too slow to use. What is "too slow" is up to you.
The template returns the cover size as "width by height". You can play with the formatting. Code:
python: def evaluate(book, context): db = context.db.new_api cover = db.cover(book.id, as_image=True) width = cover.width() height = cover.height() if width and height: return f'{str(width)} by {str(height)}' return '--' |
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,447
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Using an actions chain to compute the size on-demand then store it in a text column removes the performance penalty. I imagine that a single-field-edit action with the above template would do the job.
|
![]() |
![]() |
![]() |
#4 | |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,974
Karma: 75337983
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Quote:
|
|
![]() |
![]() |
![]() |
#5 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,974
Karma: 75337983
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
It's not a huge issue as I'll probably be leaving the column hidden in tag browser, but is there a workaround the non-numerical sorting?
|
![]() |
![]() |
Advert | |
|
![]() |
#6 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,447
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
Some thoughts:
EDIT: Using this in the template zero-fills: Code:
if width and height: return f'{width:04d} by {height:04d}' Last edited by chaley; 12-16-2024 at 11:04 AM. |
|
![]() |
![]() |
![]() |
#7 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,974
Karma: 75337983
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
I mostly expected it to sort by the first number - I have the inline numbers option enabled. Could the lack of spaces in '123x123' be mucking it up?
|
![]() |
![]() |
![]() |
#8 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,447
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
Zero-prefixing works, as would adding a string label that sorts the way you want |
|
![]() |
![]() |
![]() |
#9 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,447
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
I found why "Recognize numbers" isn't working. If the partition method is set to "first letter" then "recognize numbers inside text" is ignored. This is correct behavior because first letter sorting is equivalent to alphabetic.
However, if partitioning is turned off for that field then "recognize numbers inside text" should be honored but isn't. I'm submitting a fix for this. Last edited by chaley; 12-17-2024 at 05:47 AM. Reason: Clarity |
![]() |
![]() |
![]() |
#10 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,974
Karma: 75337983
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Yeah, I had partitioning set to first letter but disabled. Thanks for fix.
![]() |
![]() |
![]() |
![]() |
#11 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,447
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
The fix is now in calibre source.
|
![]() |
![]() |
![]() |
#12 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,974
Karma: 75337983
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
![]() |
![]() |
![]() |
![]() |
#13 | |
want to learn what I want
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,611
Karma: 7891011
Join Date: Sep 2020
Device: none
|
Quote:
1 - add in Tweaks -> Plugin Tweaks: Code:
action_chains_experimental = True 2 - Choose "Run chains in jobs" in the chain setup |
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
column for cover size | Rellwood | Calibre | 8 | 03-30-2024 11:57 PM |
Column for cover size? | Black Scholes | Library Management | 2 | 11-08-2013 03:07 AM |
Plugin or custom column to show GB size of book | mom34spartan | Plugins | 5 | 07-08-2013 09:07 AM |
Help with Custom Column 'Mobi Size' | LizPhillips | Library Management | 0 | 12-04-2012 05:56 PM |
Cover Size Column? | transmitthis | Library Management | 5 | 06-19-2011 06:27 AM |