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

Go Back   MobileRead Forums > E-Book Software > Calibre > Library Management

Notices

Reply
 
Thread Tools Search this Thread
Old 12-09-2018, 09:58 AM   #1
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
Calculate reading time.

Hello, people could help me with this:
I have two custom columns with the read start date and the end date, I want to calculate the time.
use days_between (field ('#fin'), field ('#ini'))
but in the caampo it gives me back this synthesis, I leave screenshots in case I'm doing something wrong.
Thank you.

https://ibb.co/ZzBXZCk
https://ibb.co/P5LJwqL
https://ibb.co/5BnTkgX
dunhill is offline   Reply With Quote
Old 12-10-2018, 10:19 PM   #2
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 keep turning this issue around, apparently it's how Caliber establishes it, but it does not work for me.
I will miss some complement?

Click image for larger version

Name:	aHR0cHM6Ly9pLnBvc3RpbWcuY2MvWllqSHIxWmYvQ2FwdHVyYS1kZS1wYW50YWxsYS1kZS0yMDE4LTEyLTExLTAwLTA5LTA0.png
Views:	284
Size:	142.9 KB
ID:	168276

Last edited by BetterRed; 12-11-2018 at 12:02 AM. Reason: Upload oversize images to MR - PLEASE Read Guideline (link @ end of page) #9
dunhill is offline   Reply With Quote
Advert
Old 12-11-2018, 07:36 AM   #3
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,733
Karma: 6690881
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
You must put
Code:
program:
in front of the days_between function. See the Template General Program Mode documentation.
chaley is offline   Reply With Quote
Old 12-11-2018, 05:32 PM   #4
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
Quote:
Originally Posted by chaley View Post
You must put
Code:
program:
in front of the days_between function. See the Template General Program Mode documentation.
he came to my house and I try it, thank you very much

Enviado desde mi ONEPLUS A3000 mediante Tapatalk

Venia viajando y mi ingles no es muy bueno, perdón.
Lo que he puesto es que en cuanto llegara a mi hogar lo probaria.

Last edited by dunhill; 12-11-2018 at 10:01 PM.
dunhill is offline   Reply With Quote
Old 12-11-2018, 05:43 PM   #5
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,733
Karma: 6690881
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by dunhill View Post
he came to my house and I try it, thank you very much

Enviado desde mi ONEPLUS A3000 mediante Tapatalk
Sorry, but the translation of your post (from Spanish? Portuguese?) makes no sense. Could you also post the original phrase in your language so we can try to figure out what you are really saying?
chaley is offline   Reply With Quote
Advert
Old 12-11-2018, 06:18 PM   #6
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
@chaley: I assume he meant "I tried it here and it didn't work.

@dunhill: The following is working here:

Code:
program:
days_between(field('last_modified'),field('#last_seen'));
I only have the one date custom column in the library I have here. But, it worked with the Date a Published date columns as well (once I typed their names in correctly .


And as an aside, I absolutely hate the fact that changing the template for a column changes the modified date for all books in the library. The same goes for adding a new column. Or even changing the column header. I've handled that in the source at home, but, I don't run from source on my work machine.
davidfor is offline   Reply With Quote
Old 12-11-2018, 06:25 PM   #7
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,733
Karma: 6690881
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by davidfor View Post
And as an aside, I absolutely hate the fact that changing the template for a column changes the modified date for all books in the library. The same goes for adding a new column. Or even changing the column header. I've handled that in the source at home, but, I don't run from source on my work machine.
Using the preferences editor changes the last modified date. Try editing the template from the booklist using F2 of any row of the column. IIRC that doesn't change the last modified date.

The rationale for changing the last modified date is to be sure that the backup OPF files are up to date. This is a rather complicated question, so the default is "any change requires a new backup".
chaley is offline   Reply With Quote
Old 12-11-2018, 09:54 PM   #8
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 chaley View Post
Using the preferences editor changes the last modified date. Try editing the template from the booklist using F2 of any row of the column. IIRC that doesn't change the last modified date.
That was what I was doing when I noticed modified time changing. I was thinking it didn't change, but it did this time.
Quote:
The rationale for changing the last modified date is to be sure that the backup OPF files are up to date. This is a rather complicated question, so the default is "any change requires a new backup".
The only problem with that is that the only time I needed to restore from the backup OPF files, it didn't restore the custom columns. This was for my wife's library and she only had one or two custom columns that didn't have much in them. I've been meaning to look at what went wrong, but I did follow the instructions in https://manual.calibre-ebook.com/faq...libre-is-blank. (OK, I did what I thought should work and then read the manual.) Or have I misunderstood what should happen?

From my point of view, if I add an extra column, then the backup OPF doesn't need to be updated until I populate it with a value. And the library backup status dialog has a button to "Queue all books for backup". Isn't it a matter of triggering that whenever a change is made? Except that it appears to work by changing the modified date for all books (ouch). But, it also appears to work based on the contents of the table "metadata_dirtied". I'm assuming that an entry is added to that table whenever book is modified. Finding another way to populate that after a custom column change, or pressing that button above should do what is desired. I'm sure it won't be as simple as that, but, it will be interesting to see what is needed.

A lot of the frustration with this is that I have been involved in a lot of database migrations and changes over the years. What happens with the the created dates and last modified dates is always something that gets discussed. And frequently we have to do something to prevent them from being changed.
davidfor is offline   Reply With Quote
Old 12-11-2018, 10:10 PM   #9
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
@chaley
@davidfor

I am reading your comments carefully.

Thanks to run with the word program. It has been overlooked. several eyes see better than two.
I have changed the format so that I do not get the result in decimals with this syntax:
program: format_number (days_between (field ('#dateendded'), field ('# goodreadsstarted1')), "{0: 5.0f}")
I must revise, similarly because with some dates it does not calculate me and they are loaded in the same way.
Attached Thumbnails
Click image for larger version

Name:	Clipboard01.jpg
Views:	171
Size:	54.8 KB
ID:	168297  

Last edited by chaley; 12-12-2018 at 08:31 AM. Reason: Turn huge image into an attachment
dunhill is offline   Reply With Quote
Old 12-12-2018, 12:04 AM   #10
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 dunhill View Post
@chaley
@davidfor

I am reading your comments carefully.

Thanks to run with the word program. It has been overlooked. several eyes see better than two.
I have changed the format so that I do not get the result in decimals with this syntax:
program: format_number (days_between (field ('#dateendded'), field ('# goodreadsstarted1')), "{0: 5.0f}")
I must revise, similarly because with some dates it does not calculate me and they are loaded in the same way.
Sorry, I don't know what is happening there. The two things I'd try would be restarting calibre or editing one of the dates.
davidfor is offline   Reply With Quote
Old 12-12-2018, 08:27 AM   #11
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,733
Karma: 6690881
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by davidfor View Post
That was what I was doing when I noticed modified time changing. I was thinking it didn't change, but it did this time.
My bad. It does change the time. The advantage is that it doesn't force a calibre restart
Quote:
The only problem with that is that the only time I needed to restore from the backup OPF files, it didn't restore the custom columns. This was for my wife's library and she only had one or two custom columns that didn't have much in them. I've been meaning to look at what went wrong, but I did follow the instructions in https://manual.calibre-ebook.com/faq...libre-is-blank. (OK, I did what I thought should work and then read the manual.) Or have I misunderstood what should happen?
It is supposed to work, and does work in my tests.

The only failure mode that I can think of that would cause the loss of custom columns is if the metadata_db_prefs_backup.json file is corrupt, missing the custom column definitions. If the entire file is missing then the column metadata is rebuilt from the OPF files. If "field_metadata" JSON inside the file is missing then the same thing happens. However, if the field_metadata field is there but missing the custom column metadata then the columns are lost.
Quote:
From my point of view, if I add an extra column, then the backup OPF doesn't need to be updated until I populate it with a value. And the library backup status dialog has a button to "Queue all books for backup". Isn't it a matter of triggering that whenever a change is made? Except that it appears to work by changing the modified date for all books (ouch). But, it also appears to work based on the contents of the table "metadata_dirtied". I'm assuming that an entry is added to that table whenever book is modified. Finding another way to populate that after a custom column change, or pressing that button above should do what is desired. I'm sure it won't be as simple as that, but, it will be interesting to see what is needed.
The goal was to ensure that the OPF file contains the column definitions. Values in the file aren't used except for composite column templates.
chaley is offline   Reply With Quote
Old 12-12-2018, 08:32 AM   #12
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,733
Karma: 6690881
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by dunhill View Post
@chaley
@davidfor

I am reading your comments carefully.

Thanks to run with the word program. It has been overlooked. several eyes see better than two.
I have changed the format so that I do not get the result in decimals with this syntax:
program: format_number (days_between (field ('#dateendded'), field ('# goodreadsstarted1')), "{0: 5.0f}")
I must revise, similarly because with some dates it does not calculate me and they are loaded in the same way.
Also use "raw_field" instead of "field", just in case the dates are formatting in a way that calibre cannot handle.
chaley is offline   Reply With Quote
Old 12-12-2018, 02:10 PM   #13
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
Quote:
Originally Posted by chaley View Post
Also use "raw_field" instead of "field", just in case the dates are formatting in a way that calibre cannot handle.
Thank you.

Enviado desde mi ONEPLUS A3000 mediante Tapatalk
dunhill 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
How does Kobo calculate reading statistics? Mrs_Often Kobo Reader 24 10-30-2015 03:08 AM
How does the kobo calculate book page counts? howyoudoin Kobo Reader 6 01-07-2015 11:52 AM
Is there any way to calculate page numbers better for H2O? OrangeFlavored Kobo Reader 3 10-19-2014 06:10 PM
I (almost) spend more time reading about e-readers than e-reading Antoinekamel General Discussions 15 02-25-2013 10:48 AM


All times are GMT -4. The time now is 11:37 AM.


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