Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Calibre > Library Management

Notices

Reply
 
Thread Tools Search this Thread
Old 12-15-2024, 10:34 PM   #1
Rellwood
Library Breeder (She/Her)
Rellwood ought to be getting tired of karma fortunes by now.Rellwood ought to be getting tired of karma fortunes by now.Rellwood ought to be getting tired of karma fortunes by now.Rellwood ought to be getting tired of karma fortunes by now.Rellwood ought to be getting tired of karma fortunes by now.Rellwood ought to be getting tired of karma fortunes by now.Rellwood ought to be getting tired of karma fortunes by now.Rellwood ought to be getting tired of karma fortunes by now.Rellwood ought to be getting tired of karma fortunes by now.Rellwood ought to be getting tired of karma fortunes by now.Rellwood ought to be getting tired of karma fortunes by now.
 
Rellwood's Avatar
 
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
Rellwood is offline   Reply With Quote
Old 12-16-2024, 06:05 AM   #2
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
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 '--'
Example output:
Attached Thumbnails
Click image for larger version

Name:	Clipboard01.jpg
Views:	144
Size:	5.7 KB
ID:	212514  
chaley is offline   Reply With Quote
Old 12-16-2024, 06:10 AM   #3
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
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.
chaley is offline   Reply With Quote
Old 12-16-2024, 07:02 AM   #4
ownedbycats
Custom User Title
ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.
 
ownedbycats's Avatar
 
Posts: 10,974
Karma: 75337983
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Quote:
Originally Posted by chaley View Post
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.
Instructions to install.
Attached Files
File Type: zip UpdateCoverSize.zip (2.6 KB, 151 views)
ownedbycats is online now   Reply With Quote
Old 12-16-2024, 10:36 AM   #5
ownedbycats
Custom User Title
ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.
 
ownedbycats's Avatar
 
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?

Click image for larger version

Name:	2024-12-16 11_35_37-calibre.png
Views:	262
Size:	4.3 KB
ID:	212520
ownedbycats is online now   Reply With Quote
Old 12-16-2024, 10:56 AM   #6
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,447
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by ownedbycats View Post
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?

Attachment 212520
There are two numbers. How do you expect it to sort?

Some thoughts:
  • Turn on Preferences / Behavior / Recognize numbers insize text when sorting. This seems to sort on the first number, but it might take the second into consideration when the first are the same.
  • Prefix the output with a "size" string such as "small, medium, large" or "Size 0" through "Size 9".
  • Zero-pad the numbers to enough places, probably 4.

EDIT: Using this in the template zero-fills:
Code:
	if width and height:
		return f'{width:04d} by {height:04d}'
EDIT 2: The option doesn't seem to affect the tag browser.

Last edited by chaley; 12-16-2024 at 11:04 AM.
chaley is offline   Reply With Quote
Old 12-16-2024, 11:03 AM   #7
ownedbycats
Custom User Title
ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.
 
ownedbycats's Avatar
 
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?
ownedbycats is online now   Reply With Quote
Old 12-16-2024, 11:09 AM   #8
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,447
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by ownedbycats View Post
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?
No. As I said in the above edit, that option doesn't seem to affect the tag browser. I'll look at that.

Zero-prefixing works, as would adding a string label that sorts the way you want
chaley is offline   Reply With Quote
Old 12-16-2024, 01:38 PM   #9
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
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
chaley is offline   Reply With Quote
Old 12-16-2024, 02:09 PM   #10
ownedbycats
Custom User Title
ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.
 
ownedbycats's Avatar
 
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.
ownedbycats is online now   Reply With Quote
Old 12-17-2024, 05:45 AM   #11
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,447
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
The fix is now in calibre source.
chaley is offline   Reply With Quote
Old 12-17-2024, 05:59 AM   #12
ownedbycats
Custom User Title
ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.
 
ownedbycats's Avatar
 
Posts: 10,974
Karma: 75337983
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
ownedbycats is online now   Reply With Quote
Old 12-18-2024, 06:54 AM   #13
Comfy.n
want to learn what I want
Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.
 
Posts: 1,611
Karma: 7891011
Join Date: Sep 2020
Device: none
Quote:
Originally Posted by ownedbycats View Post
When next Calibre version is released, I suggest anyone using this chain to do two things:

1 - add in Tweaks -> Plugin Tweaks:

Code:
action_chains_experimental = True
This is documented here: https://www.mobileread.com/forums/sh...postcount=1293

2 - Choose "Run chains in jobs" in the chain setup
Comfy.n is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
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


All times are GMT -4. The time now is 01:23 PM.


MobileRead.com is a privately owned, operated and funded community.