Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 07-30-2020, 11:02 AM   #16
Mansoul
Member
Mansoul is out to avenge the death of his or her father, Domingo Montoya.Mansoul is out to avenge the death of his or her father, Domingo Montoya.Mansoul is out to avenge the death of his or her father, Domingo Montoya.Mansoul is out to avenge the death of his or her father, Domingo Montoya.Mansoul is out to avenge the death of his or her father, Domingo Montoya.Mansoul is out to avenge the death of his or her father, Domingo Montoya.Mansoul is out to avenge the death of his or her father, Domingo Montoya.Mansoul is out to avenge the death of his or her father, Domingo Montoya.Mansoul is out to avenge the death of his or her father, Domingo Montoya.Mansoul is out to avenge the death of his or her father, Domingo Montoya.Mansoul is out to avenge the death of his or her father, Domingo Montoya.
 
Posts: 19
Karma: 34258
Join Date: Jul 2020
Device: Kobo Libra H2O
Quote:
Originally Posted by davidfor View Post
And here was me thinking of doing:

Code:
program:
minutes = divide(raw_field('#words'),310);
hours = divide(minutes, 60);
hours = list_item(hours,0,'.');
minutes = subtract(minutes, multiply(hours,60));
minutes = format_number(minutes, '02,.0f');
strcat(hours,':',minutes)
Ugly, but it seems to work. I'd probably combine a couple of lines, but, separating them helps the debugging.

But, I've wanted some of your new functions before. So, I'm happy to see them.
I'm using this now, love it.
Mansoul is offline   Reply With Quote
Old 07-30-2020, 01:26 PM   #17
crane3
Guru
crane3 ought to be getting tired of karma fortunes by now.crane3 ought to be getting tired of karma fortunes by now.crane3 ought to be getting tired of karma fortunes by now.crane3 ought to be getting tired of karma fortunes by now.crane3 ought to be getting tired of karma fortunes by now.crane3 ought to be getting tired of karma fortunes by now.crane3 ought to be getting tired of karma fortunes by now.crane3 ought to be getting tired of karma fortunes by now.crane3 ought to be getting tired of karma fortunes by now.crane3 ought to be getting tired of karma fortunes by now.crane3 ought to be getting tired of karma fortunes by now.
 
Posts: 608
Karma: 5007204
Join Date: Sep 2014
Location: Calif
Device: Fire hdx 8.9, Tab S2, Tab S5e, Aura ONE
One need to add time for high-lighting, annotations, looking up in the dictionary to estimate 'how long to read'. Not needed for people not doing highlighting or annotations or dictionary lookup except for inadvertent highlighting via a touch.
crane3 is offline   Reply With Quote
Advert
Old 07-30-2020, 01:52 PM   #18
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,734
Karma: 6690881
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by davidfor View Post
And here was me thinking of doing:

Code:
program:
minutes = divide(raw_field('#words'),310);
hours = divide(minutes, 60);
hours = list_item(hours,0,'.');
minutes = subtract(minutes, multiply(hours,60));
minutes = format_number(minutes, '02,.0f');
strcat(hours,':',minutes)
Ugly, but it seems to work. I'd probably combine a couple of lines, but, separating them helps the debugging.

But, I've wanted some of your new functions before. So, I'm happy to see them.
This is a very interesting use of list_item. Cool. It got me thinking about other unusual ways to solve the problem using the period as a separator. I came up with this
Code:
program:
	fractional_hours = 3.6982;
	re_group(
		fractional_hours,
		'(.*)(\..*)',
		'{$}:', 
		"program: format_number(multiply($, 60), '02.0f')"
	)
This works as long as there really is a period in the number.

Last edited by chaley; 07-30-2020 at 01:54 PM.
chaley is offline   Reply With Quote
Old 07-31-2020, 07:01 AM   #19
kcar181
Member
kcar181 began at the beginning.
 
kcar181's Avatar
 
Posts: 15
Karma: 10
Join Date: Jul 2020
Device: none
Talking

Quote:
Originally Posted by davidfor View Post
And here was me thinking of doing:

Code:
program:
minutes = divide(raw_field('#words'),310);
hours = divide(minutes, 60);
hours = list_item(hours,0,'.');
minutes = subtract(minutes, multiply(hours,60));
minutes = format_number(minutes, '02,.0f');
strcat(hours,':',minutes)
Ugly, but it seems to work. I'd probably combine a couple of lines, but, separating them helps the debugging.

But, I've wanted some of your new functions before. So, I'm happy to see them.
Oh yay this is awesome
kcar181 is offline   Reply With Quote
Old 07-31-2020, 08:16 AM   #20
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,734
Karma: 6690881
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by davidfor View Post
But, I've wanted some of your new functions before. So, I'm happy to see them.
The new functions are in calibre source now and will be included in the next calibre release (not the one today).
chaley is offline   Reply With Quote
Advert
Old 08-07-2020, 12:04 PM   #21
Foxarts
Junior Member
Foxarts began at the beginning.
 
Posts: 1
Karma: 10
Join Date: Aug 2020
Device: Kindle
Quote:
Originally Posted by kcar181 View Post
Oh yay this is awesome
Hi guys, first post here.
Sorry for my english and for my italian version of calibre

Anyway, I'll try to figure out add reading time column as show in this thread, but it doesn't work for me:

Click image for larger version

Name:	Schermata 2020-08-07 alle 17.54.46.png
Views:	180
Size:	164.5 KB
ID:	181167

I'm using a raw_field that isn't the number of words of the book but just the number of the pages (is what I have at the moment), but the results is always 0:00.

What I miss?

Thanks

my Calibre version: 4.16
Foxarts is offline   Reply With Quote
Old 08-07-2020, 11:38 PM   #22
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 24,907
Karma: 47303748
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
Quote:
Originally Posted by Foxarts View Post
Hi guys, first post here.
Sorry for my english and for my italian version of calibre

Anyway, I'll try to figure out add reading time column as show in this thread, but it doesn't work for me:

Attachment 181167

I'm using a raw_field that isn't the number of words of the book but just the number of the pages (is what I have at the moment), but the results is always 0:00.

What I miss?
In the original versions, the 310 is the reading speed in words per minute. If you are using the page count, you need to change this to your reading speed in pages per minute.
davidfor is offline   Reply With Quote
Old 08-09-2020, 09:19 PM   #23
dunhill
Guru
dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.
 
dunhill's Avatar
 
Posts: 720
Karma: 228142
Join Date: Sep 2017
Location: Argentina
Device: moon+ reader, kindle paperwhite
I have configured my reading time with this template:
program:

# This program calculate a reading time per hour for an ebook

# Adjustments:
# w_min -> minimum words per minute
# w_max -> maximum words per minute
w_min = 250;
w_max = 300;

# readingtime per hour = 60
p_time = 60;

# Needs a custom column for word count (#words)
# change it to your field name
words = raw_field ('# words');

time1 = format_number (divide (words, multiply (w_max, p_time)), '{0: .2f}');
time2 = format_number (divide (words, multiply (w_min, p_time)), '{0: .2f}');

# Unfortunately Caliber doesn't provide a simple way to convert a float
# into a time string -> I used a regex
# The minutes can be set to use 2 numbers using python number formatting,
# otherwise times are displayed as 4: 4h instead of 4: 04h.
rt1_hour = re (time1, '\. \ d *', '');
rt1_minute = format_number (multiply (subtract (time1, rt1_hour), 60), '{0: 02.0f}');

rt2_hour = re (time2, '\. \ d *', '');
rt2_minute = format_number (multiply (subtract (time2, rt2_hour), 60), '{0: 02.0f}');

readingtime = strcat (rt1_hour, ':', rt1_minute, 'h -', rt2_hour, ':', rt2_minute, 'h');

https://www.mobileread.com/forums/sh....php?p=3534411
Attached Thumbnails
Click image for larger version

Name:	1.png
Views:	137
Size:	72.6 KB
ID:	181215   Click image for larger version

Name:	2.png
Views:	86
Size:	7.6 KB
ID:	181216  
dunhill is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Browser Viewer: Long-text Custom Column nqk Server 8 08-05-2018 08:25 AM
Custom column long text toolbar MerlinMama Calibre 2 03-01-2017 01:14 PM
Creating Custom Column for Read and Date Read library addict Calibre Companion 11 03-22-2014 05:33 AM
Custom yes/no column built from long text column Philantrop Library Management 7 03-23-2013 07:44 PM
No search/replace on custom long text column? CWatkinsNash Library Management 2 06-20-2011 05:57 PM


All times are GMT -4. The time now is 07:47 PM.


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