![]() |
Calibre Sort by Size Not Refreshing
Hello! I was wondering if anyone would know how to fix this:
I noticed the other day that some of my ebooks were humongous in size, so I added a 'size' column in Calibre and sorted them by size. Then I started individually opening each folder and trimming the ebooks down in size (removing custom fonts and jpegs from epubs, etc.). I noticed, though, that even though I restarted Calibre and the computer, Calibre still displays the old size of the files in the 'size' sorting column. It still says, for instance, 82 mb for a file that is now only 2 mb. How do I make Calibre show the actual, updated file size for each ebook? |
The size column in calibre is only updated when you add/remove a book format. IIRC the quality check plugin has an option to scan the library and update that info.
|
I see, thank you, will check out that plugin!
|
Did you solve this? I have this issue also.
|
Quote:
FWIW the size also updates after a Tweak-book (Calibre Editor) |
It was an ancient post without a confirmed resolution.
I'm working with PDFs rather than ePubs. https://www.mobileread.com/forums/sh...d.php?t=292065 Kovid's "add/remove a book format" does not seem to work for PDFs. I've tried QC PI and had no luck. Which option have you seen resolve this size issue? And I don't think Tweak Books is in the latest Calibre? Any help appreciated. |
data is at:
metadata.db TABLE data COLUMN uncompressed_size |
Quote:
Neither work on PDF. (which was not mentioned in post 1) |
The size calibre displays is a not a file size, it is the size of the largest of a book's files, and it is updated when you add/remove a format, regardless of what format the book is in.
|
I ended up using "restore database" in the Calibre Library menu
thanks all |
Refresh size
I KNOW ;) that I'm reopening years old thread.
I have the same problem as OP, I modify files directly in Calibre library directory. Tried to use (most probably abandoned) QualityCheck plugin, it does not work on current Calibre, because it calls: formats = db.formats(book_id, index_is_id=True, verify_formats=False) for fmt in formats.split(','): db_size = db.sizeof_format(book_id, fmt, index_is_id=True) but that is implemented in legacy.py as filesystem read, instead of table read. So this check is always 'good', because it compares disk size to disk size and thus does not fix db. So question, directly to Kovid, if possible: With what call should be db.sizeof_format replaced with to get data from uncompressed_size column? Thx, J. |
Quote:
Moderator Notice The QC PI will need to be updated to support Python 3 used the upcoming Calibre 5 release. One of the active PI developers will do that… I hope ;) BR |
Fix
So I replaced this line (in QualityCheck.zip/check_fix.py)
db_size = db.sizeof_format(book_id, fmt, index_is_id=True) with db_size = next(db.backend.execute( "SELECT uncompressed_size FROM data WHERE book=? AND format=?", ( book_id, fmt ) ))[0] which does what I need in QualityCheck/Fix/Check and repair file sizes. I wasn't able to do that using any LibraryDatabase or Cache call. |
You use format_metadata() Note that uncompressed_size is not actually used for anything. Sizes of individual format files are read from the filesystem with a cache for performance.
|
Quote:
With the fix I made, uncompress_size and also the max of all formats are updated, which makes me happy (since I use sqlite db dump of metadata.db to do some other checks externally). |
| All times are GMT -4. The time now is 06:10 PM. |
Powered by: vBulletin
Copyright ©2000 - 3.8.5, Jelsoft Enterprises Ltd.
MobileRead.com is a privately owned, operated and funded community.