![]() |
#1 |
2 lzy 2 update this...
![]() Posts: 9
Karma: 10
Join Date: Apr 2011
Device: jetbook
|
Can't get {size} data in a User Column?
Hello,
I was messing around trying to figure out how to display the filesizes in a more usable metric than MB (you know how *many* books I have that are '0.6 MB'?) and so I was trying to set up a user defined column to display size in kB. I made the column okay, but when I put {size} in the template, it populates the column with emptiness...aching emptiness. If I change the template column definition to {tags} for instance, it populates properly...so what's up with not being able to pull the 'size'? I'm probably just missing something... Alternately, could someone let me know if there's an easier way to display the file sizes in kilobytes? Thanks, cc |
![]() |
![]() |
![]() |
#2 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,447
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Size was added as a template field, then removed because it badly broke device metadata caching. As a result, there is currently no way to get at size in a template.
I have submitted changes to add a new formatter function to get the value of 'size'. Assuming acceptance, in the next release you will be able to use one of the following: Code:
program:booksize() {:'booksize()'} Code:
program:divide(booksize(), 1000) {:'divide(booksize(), 1000)'} |
![]() |
![]() |
![]() |
#3 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 9,707
Karma: 32763414
Join Date: Dec 2008
Location: Krewerd
Device: Pocketbook Inkpad 4 Color; Samsung Galaxy Tab S6
|
Lazy people! 1000Kb isn't 1Mb...
It looks like I missed something in the custom column definition... program??? |
![]() |
![]() |
![]() |
#4 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,447
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
I leave it to you to explain why it should be 1024 instead of 1000.
![]() Quote:
|
|
![]() |
![]() |
![]() |
#5 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 9,707
Karma: 32763414
Join Date: Dec 2008
Location: Krewerd
Device: Pocketbook Inkpad 4 Color; Samsung Galaxy Tab S6
|
See, I did blink and missed something...
|
![]() |
![]() |
![]() |
#6 |
2 lzy 2 update this...
![]() Posts: 9
Karma: 10
Join Date: Apr 2011
Device: jetbook
|
Cool, thanks!
Just thought I should bring it up, since the behaviour wasn't consistent with the other fields from the user's POV. It's not a big deal, it's just a 'nice to know' kinda thing... Quick question, though: chaley, you said this was to be a possible new function, so would it have to re-calculate booksize for every book each time the booklist is adjusted? (Question carry-over from comments on a previous thread re: showing number of pages / word counts). Or is this just adding a function to pull the booksize from a stored metadata field, either in the book or the file data itself? For all I know, they could take roughly the same time to do either, so the question might be entirely moot...just curious. Thanks for the quick reply! cc |
![]() |
![]() |
![]() |
#7 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,447
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
The changes have been officially merged into calibre, and will be available at the next release. |
|
![]() |
![]() |
![]() |
#8 |
2 lzy 2 update this...
![]() Posts: 9
Karma: 10
Join Date: Apr 2011
Device: jetbook
|
![]() |
![]() |
![]() |
![]() |
#9 |
Enthusiast
![]() Posts: 26
Karma: 10
Join Date: Mar 2011
Device: Awful Hanvon N518
|
I have looked at template , booksize and format_sizes and cannot see how i can change this. Can someone please explain so that i can see my column size in Kb to do duplicate checking faster rather than opening 150 separate windows in windows explorer for each duplicate.
Many thanks R |
![]() |
![]() |
![]() |
#10 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,447
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
|
|
![]() |
![]() |
![]() |
#11 |
Enthusiast
![]() Posts: 26
Karma: 10
Join Date: Mar 2011
Device: Awful Hanvon N518
|
Thanks Chaley for you very fast and prompt answer.
|
![]() |
![]() |
![]() |
#12 |
Calibre Plugins Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,729
Karma: 2197770
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
|
Why not use the Find Duplicates plugin? It is *way* faster and more reliable than manually comparing size values?
|
![]() |
![]() |
![]() |
#13 |
hopeless n00b
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 5,110
Karma: 19597086
Join Date: Jan 2009
Location: in the middle of nowhere
Device: PW4, PW3, Libra H2O, iPad 10.5, iPad 11, iPad 12.9
|
Question, is the value booksize() returns in bytes or kilobytes? Nvm, found the answer from a link above. Bytes.
|
![]() |
![]() |
![]() |
#14 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,447
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
|
![]() |
![]() |
![]() |
#15 |
hopeless n00b
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 5,110
Karma: 19597086
Join Date: Jan 2009
Location: in the middle of nowhere
Device: PW4, PW3, Libra H2O, iPad 10.5, iPad 11, iPad 12.9
|
Gotcha. Thanks! Doesn't really matter for me since the library I need it for only has one format - epub. Curious, what does the size column in calibre report? Size of largest or the total size?
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
[Old Thread] User Defined Column | Cpl Punishment | Calibre | 17 | 02-16-2014 01:43 AM |
User Column Search | spruce | Calibre | 9 | 01-15-2011 04:01 PM |
Refresh size column | Perkin | Calibre | 5 | 09-10-2010 11:31 AM |
HTML column type in custom meta-data. | mukoan | Calibre | 1 | 07-13-2010 08:59 AM |
Purpose of Size column? | itimpi | Calibre | 6 | 06-16-2009 08:44 PM |