Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 03-29-2024, 05:46 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,168
Karma: 1900479
Join Date: Apr 2015
Location: Fullerton, California
Device: Kobo Aura HD (1) PW3 (4) PW3 2019 new edition (1)
column for cover size

I wanted to make a custom column showing the coversize of the book how would I go about doing that? - I'm trying to find covers that don't show well on my Kindle and by knowing the size of the covers that DO show well, I can find the ones that don't and then change their sizes.
Rellwood is offline   Reply With Quote
Old 03-29-2024, 09:08 PM   #2
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 29,945
Karma: 55705602
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Rather than a column...
The Quality check plugin: Check Covers: <select>Less than <value>
All you need to do is figure what your threshold of cover size tolerance is.
theducks is offline   Reply With Quote
Advert
Old 03-30-2024, 08:23 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: 11,774
Karma: 7029857
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Directly answering the question ...

In the past you haven't seemed interested in solutions involving composite columns and templates, but just in case I am wrong, here is one. It returns the width and height of the cover image. Performance isn't excellent because it must read the actual cover file off the disk. I suggest that if you use it then you display the results in book details and not in the book list making performance much less of an issue.

You would put this in a "Column built from other columns" with "Show as html" unchecked. You could check "Show in Tag browser" but it isn't obvious why you would want this.
Code:
python:
def evaluate(book, context):
	from io import BytesIO
	from PIL import Image
	mi = context.db.new_api.get_metadata(book.id, get_cover=True, cover_as_data=True)
	if mi.cover_data[1] is not None:
		pm = Image.open(BytesIO(mi.cover_data[1]))
		ans = f'w={str(pm.width)}, h={str(pm.height)}'
	else:
		ans = 'No cover'
	return ans
Attached Thumbnails
Click image for larger version

Name:	Clipboard01.jpg
Views:	43
Size:	69.0 KB
ID:	207243  

Last edited by chaley; 03-30-2024 at 08:25 AM. Reason: Added screen capture showing the output
chaley is offline   Reply With Quote
Old 03-30-2024, 04:38 PM   #4
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,168
Karma: 1900479
Join Date: Apr 2015
Location: Fullerton, California
Device: Kobo Aura HD (1) PW3 (4) PW3 2019 new edition (1)
Actually, it's not that I'm not interested in using templates or custom columns, it's that I for some reason have had problems trying to figure out coding. I'm like the person who doesn't know carpentry but is trying to build a table with ductape and glue. Still get a table, but it's a bit clunky.

Thanks for the column instructions. I will update to see how it works. What I will do, is make the column, then create a second tag column or text column that will be blank. Then when the custom column populates, I can copy it over to the blank column then delete the custom column. I am not sure, if a column isn't being shown in the booklist, does it still populate and make the program slow?

Also, theducks suggestion of the book check plugin was actually running through my mind just before I saw his response.

I will try the column just to stretch my abilities though.

I need to really learn how to code and make templates. I have actually used Chat AI for creating scripts for stuff in the past to go through batches of files for things. It actually worked!

Last edited by Rellwood; 03-30-2024 at 04:41 PM.
Rellwood is offline   Reply With Quote
Old 03-30-2024, 06:31 PM   #5
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: 11,774
Karma: 7029857
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by Rellwood View Post
Actually, it's not that I'm not interested in using templates or custom columns, it's that I for some reason have had problems trying to figure out coding. I'm like the person who doesn't know carpentry but is trying to build a table with ductape and glue. Still get a table, but it's a bit clunky.
If you have questions or problems, just ask.
Quote:
[...]
I am not sure, if a column isn't being shown in the booklist, does it still populate and make the program slow?
Assuming you are running calibre 7.7, composite columns are evaluated when the value is needed for a book, such as when:
  • the book is shown in book details.
  • the book is shown in the booklist.
  • you sort on the column.
  • you search on the column.
If the column isn't shown in the book list then the last 3 won't happen unless you specifically use something like Search or Sort by to reference the column.

Versions of calibre before 7.7 would evaluate the columns if book details might be shown even if the details never were actually shown. Because of this, scrolling through the booklist could be slow. I hope that problem is now gone.
Quote:
I need to really learn how to code and make templates. I have actually used Chat AI for creating scripts for stuff in the past to go through batches of files for things. It actually worked!
I'm glad for that it has worked for you. I must confess, though, that I find it hard to believe that generative AI will write correct & efficient code. But then I come from 60's-70's schools of computing, when even making a program do *anything* was a challenge.
chaley is offline   Reply With Quote
Advert
Old 03-30-2024, 10:21 PM   #6
DNSB
Bibliophagist
DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.
 
DNSB's Avatar
 
Posts: 36,515
Karma: 145748890
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
Quote:
Originally Posted by chaley View Post
I'm glad for that it has worked for you. I must confess, though, that I find it hard to believe that generative AI will write correct & efficient code. But then I come from 60's-70's schools of computing, when even making a program do *anything* was a challenge.
There have been several instances in Mobileread forums where someone has looked for help with a program generated by generative AI. One forum that I hang out in once in a while has now banned asking questions about such programs since all too often, the person submitting the question lacks the skills to make use of any help they are given so they basically need to have the program rewritten for them which turns into a time sink.

Somewhere in the basement, I still have the code and output from the first WatFOR program I wrote in 1968 that actually ran. I used the 3-way arithmetic IF a few times and committed multiple other sins making debugging the program a total pain.
DNSB is offline   Reply With Quote
Old 03-30-2024, 10:27 PM   #7
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,041
Karma: 6422750
Join Date: Sep 2020
Device: Calibre E-book viewer
Quote:
Originally Posted by Rellwood View Post
I have actually used Chat AI for creating scripts for stuff in the past to go through batches of files for things. It actually worked!
Yes I was astonished when gpt succesfully created for me an MS Word macro that would insert simple Anki Cloze-like {c1} brackets on selected text. It presented two ways to do it, depending on Office 32 or 64 bit version, so it was a bit tricky to get it working like I wanted:

Spoiler:
Sub InsertCloze()
Dim clozeNumber As Integer
clozeNumber = 1
Dim currentRange As Range
Set currentRange = Selection.Range

Dim dataObj As New MSForms.DataObject
dataObj.GetFromClipboard
Dim clipboardText As String
clipboardText = dataObj.GetText

currentRange.Text = Replace(currentRange.Text, Selection.Text, "{{c" & clozeNumber & "::" & Selection.Text & "}}")
clozeNumber = clozeNumber + 1
End Sub


And it also helped creating a similar AHK script.
I guess it works well for programming stuff that don't require too much critical 'thinking'

Last edited by Comfy.n; 03-30-2024 at 11:23 PM.
Comfy.n is online now   Reply With Quote
Old 03-30-2024, 11:05 PM   #8
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,994
Karma: 22669822
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Quote:
Originally Posted by chaley View Post
I'm glad for that it has worked for you. I must confess, though, that I find it hard to believe that generative AI will write correct & efficient code. But then I come from 60's-70's schools of computing, when even making a program do *anything* was a challenge.
Anything beyond trivial, small, well documented on the internet examples it tends to fail at, and fail in non obvious ways, often inventing API functions that would do what the user asked but that dont actually exist. That said, if you are new to an area it is a great way to get started and to get pointers to areas of the API that would take you much longer to find by traditional methods of exploration.
kovidgoyal is offline   Reply With Quote
Old 03-30-2024, 11:57 PM   #9
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: 8,808
Karma: 62032371
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Quote:
Originally Posted by chaley View Post
I'm glad for that it has worked for you. I must confess, though, that I find it hard to believe that generative AI will write correct & efficient code. But then I come from 60's-70's schools of computing, when even making a program do *anything* was a challenge.
Quote:
Originally Posted by kovidgoyal View Post
Anything beyond trivial, small, well documented on the internet examples it tends to fail at, and fail in non obvious ways, often inventing API functions that would do what the user asked but that dont actually exist. That said, if you are new to an area it is a great way to get started and to get pointers to areas of the API that would take you much longer to find by traditional methods of exploration.
On the Discord server for Playnite, the main developer of the project gets rather frustrated with people trying to use ChatGPT to create extensions.
ownedbycats is online now   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
size in kb column Rellwood Library Management 5 03-09-2021 05:55 PM
cover size - epub what's a good size? christopher22 Calibre 3 01-19-2019 04:56 PM
Column for cover size? Black Scholes Library Management 2 11-08-2013 03:07 AM
size column iomari Calibre 6 09-30-2011 07:00 AM
Cover Size Column? transmitthis Library Management 5 06-19-2011 06:27 AM


All times are GMT -4. The time now is 02:47 AM.


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