Register Guidelines E-Books Today's Posts Search

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

Notices

Reply
 
Thread Tools Search this Thread
Old 04-15-2023, 07:10 AM   #1
Bertrand
Zealot
Bertrand began at the beginning.
 
Posts: 124
Karma: 10
Join Date: Dec 2008
Location: France
Device: None
Save to disk : adding pubdate to the filename

I'm trying to add the pubdate to every book when I save to disk :
For now, my template is as follow :
{author_sort[0]}/{author_sort} - {series}{series_index:0>2s| | - } {title} ({pubdate})

which gives : D/Doe, John/Title (2021)

But, obviously, some books have no pubdate, and I get this :

B/Bench, John/Title of the book (101)

(What is this "101" number ?)

So my goal is :
if pubdate = 101 do nothing
else add "(pubdate)"

I have tried various variations based on the series model but I can't get anywhere.

Thanks for your help.
Bertrand is offline   Reply With Quote
Old 04-15-2023, 11:22 AM   #2
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 31,037
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
101 is the basis (base) of a Date data type everyplace in Calibre. I believe this is part of the open database package Calibre is built upon
theducks is offline   Reply With Quote
Advert
Old 04-17-2023, 01:59 AM   #3
Bertrand
Zealot
Bertrand began at the beginning.
 
Posts: 124
Karma: 10
Join Date: Dec 2008
Location: France
Device: None
Thanks theducks for the explanation.


Maybe someone will have an idea for the last part of my question.
Bertrand is offline   Reply With Quote
Old 04-17-2023, 11:01 AM   #4
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 31,037
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Quote:
Originally Posted by Bertrand View Post
Thanks theducks for the explanation.


Maybe someone will have an idea for the last part of my question.
You could always us 2 templates for now
Search:
Code:
not pubdate:true
gets you those books with no pubdate
The not is because of the underlying 101
theducks is offline   Reply With Quote
Old 04-17-2023, 01:22 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: 12,436
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by Bertrand View Post
I have tried various variations based on the series model but I can't get anywhere.

Thanks for your help.
It is supposed to be empty, not 101. The fact that it isn't is a bug. I will submit a fix.
chaley is offline   Reply With Quote
Advert
Old 04-17-2023, 02:57 PM   #6
ownedbycats
Custom User Title
ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.
 
ownedbycats's Avatar
 
Posts: 10,948
Karma: 74999999
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
What kind of time formatting uses 101 as an epoch anyways? Google is failing me...
ownedbycats is offline   Reply With Quote
Old 04-17-2023, 03:06 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: 12,436
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by ownedbycats View Post
What kind of time formatting uses 101 as an epoch anyways? Google is failing me...
Some value must be chosen for undefined. That value must work in sqlite, in python (2 & 3), and in other libraries, which means that NULL, None, and empty don't work.

Many years ago (probably > 15) the choice was made to use 1 Jan 0101 as the undefined date. It is up to the user to check. Somewhere lost in time that check disappeared from save-to-disk template handing, which BTW although it looks a bit like SFM it is *not* using the calibre template language. Again, historical. There are a few cases like this that predate the template language or require processing where the template processor doesn't exist.

I often run across code I wrote before templates existed. And before a consolodated metadata structure existed. And before consistent custom columns existed. And ...
chaley is offline   Reply With Quote
Old 04-17-2023, 03:31 PM   #8
ownedbycats
Custom User Title
ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.
 
ownedbycats's Avatar
 
Posts: 10,948
Karma: 74999999
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Normally, I'd expect the Unix Epoch, but I suspect it was chosen against this considering the purpose of Calibre and the number of books published before 1970...
ownedbycats is offline   Reply With Quote
Old 04-17-2023, 03:50 PM   #9
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: 12,436
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by ownedbycats View Post
Normally, I'd expect the Unix Epoch, but I suspect it was chosen against this considering the purpose of Calibre and the number of books published before 1970...
That epoch is measured in seconds since X. That scheme doesn't work with many database date types where you must store a 'real' date or empty. You could make it work by storing a large natural number (64 bit) that represents seconds (plus or minus) from some base date, but doing so would make the database hard to use. Reading a date would always require calculation.

FWIW: I was at BTL when we started worrying about whether seconds-from-1970 would be storable with the integer types we had (32 bits signed). We hadn't done anything about it before I left (1979), but we knew we had made a mistake.
chaley is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
how to populate pubdate and page count when adding a book? Fynjisx Calibre 9 08-07-2022 02:39 PM
Using Save to Disk, how to add to the end of the exported filename? lue42 Library Management 7 07-12-2020 08:01 PM
“Saving to disk” – How to save books with a shorter title length in filename? ToBiku Library Management 4 04-30-2020 04:14 AM
calibre - save to disk sort pubdate descending dnm43 Library Management 1 02-13-2016 01:35 PM
Save to disk generate wrong filename abuck Conversion 2 10-14-2013 01:00 AM


All times are GMT -4. The time now is 12:00 AM.


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