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

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 04-18-2011, 09:04 PM   #1
CCarrot
2 lzy 2 update this...
CCarrot began at the beginning.
 
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
CCarrot is offline   Reply With Quote
Old 04-19-2011, 04:48 AM   #2
chaley
"chaley", not "charley"
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: 5,292
Karma: 821512
Join Date: Jan 2010
Location: France
Device: Many android devices
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()'}
If you want kbytes, use
Code:
program:divide(booksize(), 1000)
{:'divide(booksize(), 1000)'}
chaley is offline   Reply With Quote
Old 04-19-2011, 05:10 AM   #3
Sweetpea
Grand Sorcerer
Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.
 
Sweetpea's Avatar
 
Posts: 7,992
Karma: 22685988
Join Date: Dec 2008
Location: Krewerd
Device: HTC Flyer; BBMini; Sony PRS650; Onyx Boox T68
Lazy people! 1000Kb isn't 1Mb...

It looks like I missed something in the custom column definition... program???
Sweetpea is offline   Reply With Quote
Old 04-19-2011, 05:15 AM   #4
chaley
"chaley", not "charley"
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: 5,292
Karma: 821512
Join Date: Jan 2010
Location: France
Device: Many android devices
Quote:
Originally Posted by Sweetpea View Post
Lazy people! 1000Kb isn't 1Mb...
I leave it to you to explain why it should be 1024 instead of 1000.
Quote:
It looks like I missed something in the custom column definition... program???
That is the prefix for general program mode templates. See "Using general program mode" in the documentation for details.
chaley is offline   Reply With Quote
Old 04-19-2011, 06:11 AM   #5
Sweetpea
Grand Sorcerer
Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.
 
Sweetpea's Avatar
 
Posts: 7,992
Karma: 22685988
Join Date: Dec 2008
Location: Krewerd
Device: HTC Flyer; BBMini; Sony PRS650; Onyx Boox T68
See, I did blink and missed something...
Sweetpea is offline   Reply With Quote
Old 04-19-2011, 11:22 AM   #6
CCarrot
2 lzy 2 update this...
CCarrot began at the beginning.
 
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
CCarrot is offline   Reply With Quote
Old 04-19-2011, 01:08 PM   #7
chaley
"chaley", not "charley"
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: 5,292
Karma: 821512
Join Date: Jan 2010
Location: France
Device: Many android devices
Quote:
Originally Posted by CCarrot View Post
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?
The booksize function grabs the information from the calibre database field. No recomputation is needed.

The changes have been officially merged into calibre, and will be available at the next release.
chaley is offline   Reply With Quote
Old 04-19-2011, 01:58 PM   #8
CCarrot
2 lzy 2 update this...
CCarrot began at the beginning.
 
Posts: 9
Karma: 10
Join Date: Apr 2011
Device: jetbook
Talking

Quote:
Originally Posted by chaley View Post
The changes have been officially merged into calibre, and will be available at the next release.
Dude! That was fast! I look forward to playing with it come next release.

Thanks so much!
cc
CCarrot is offline   Reply With Quote
Old 06-24-2012, 04:27 AM   #9
theaccountant
Member
theaccountant began at the beginning.
 
Posts: 10
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
theaccountant is offline   Reply With Quote
Old 06-24-2012, 04:34 AM   #10
chaley
"chaley", not "charley"
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: 5,292
Karma: 821512
Join Date: Jan 2010
Location: France
Device: Many android devices
Quote:
Originally Posted by theaccountant View Post
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.
See http://www.mobileread.com/forums/sho...12#post2108012 and/or http://www.mobileread.com/forums/sho...d.php?t=151563
chaley is offline   Reply With Quote
Old 06-24-2012, 06:27 AM   #11
theaccountant
Member
theaccountant began at the beginning.
 
Posts: 10
Karma: 10
Join Date: Mar 2011
Device: Awful Hanvon N518
Thanks Chaley for you very fast and prompt answer.
theaccountant is offline   Reply With Quote
Old 06-24-2012, 06:56 AM   #12
kiwidude
calibre/Sigil Developer
kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.
 
Posts: 4,224
Karma: 1334002
Join Date: Oct 2010
Location: London, UK
Device: Kindle Paperwhite 3G, iPad 3, iPad Air
Quote:
Originally Posted by theaccountant View Post
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.
Why not use the Find Duplicates plugin? It is *way* faster and more reliable than manually comparing size values?
kiwidude is offline   Reply With Quote
Old 06-25-2012, 07:15 PM   #13
ilovejedd
hopeless n00b
ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.
 
ilovejedd's Avatar
 
Posts: 2,309
Karma: 5761596
Join Date: Jan 2009
Location: in the middle of nowhere
Device: PRS-350, Nexus S, Galaxy S, Nook Color, iPhone4, iPT4, iPad 2012
Question, is the value booksize() returns in bytes or kilobytes? Nvm, found the answer from a link above. Bytes.
ilovejedd is offline   Reply With Quote
Old 06-25-2012, 11:47 PM   #14
chaley
"chaley", not "charley"
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: 5,292
Karma: 821512
Join Date: Jan 2010
Location: France
Device: Many android devices
Quote:
Originally Posted by ilovejedd View Post
Question, is the value booksize() returns in bytes or kilobytes? Nvm, found the answer from a link above. Bytes.
NB: it returns the size of the largest format, not the total size of all the formats.
chaley is offline   Reply With Quote
Old 06-26-2012, 01:36 AM   #15
ilovejedd
hopeless n00b
ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.
 
ilovejedd's Avatar
 
Posts: 2,309
Karma: 5761596
Join Date: Jan 2009
Location: in the middle of nowhere
Device: PRS-350, Nexus S, Galaxy S, Nook Color, iPhone4, iPT4, iPad 2012
Quote:
Originally Posted by chaley View Post
NB: it returns the size of the largest format, not the total size of all the formats.
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?
ilovejedd 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
[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


All times are GMT -4. The time now is 08:18 PM.


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