View Single Post
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: 896
Karma: 810834
Join Date: Sep 2017
Location: Buenos Aires, 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:	181
Size:	72.6 KB
ID:	181215   Click image for larger version

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