Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 04-07-2010, 05:21 PM   #16
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,740
Karma: 6997045
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by theducks View Post
SQL lite allows 2 dates within one field? I was looking for a second Date capable field
Nope. Both are in the books table. One is named timestamp (and is a timestamp), and the other is named pubdate.
chaley is offline   Reply With Quote
Old 04-07-2010, 05:31 PM   #17
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: 29,799
Karma: 54830978
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 chaley View Post
Nope. Both are in the books table. One is named timestamp (and is a timestamp), and the other is named pubdate.
I am looking at the file /opt/calibre/resources/metadata_sqlite.sql and that field is not there
I assumed this was the file used to create the original (empty) DB. Is there a altertable somewhere else? (I am NOT a SQL expert)
theducks is offline   Reply With Quote
Advert
Old 04-07-2010, 07:49 PM   #18
Starson17
Wizard
Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.
 
Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
Quote:
Originally Posted by theducks View Post
I am looking at the file /opt/calibre/resources/metadata_sqlite.sql and that field is not there
I assumed this was the file used to create the original (empty) DB. Is there a altertable somewhere else? (I am NOT a SQL expert)
Look at metadata.db with SQLiteSpy or a similar tool.
Starson17 is offline   Reply With Quote
Old 04-07-2010, 08:29 PM   #19
itimpi
Wizard
itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.
 
Posts: 4,552
Karma: 950151
Join Date: Nov 2008
Device: Sony PRS-950, iphone/ipad (Marvin/iBooks/QuickReader)
Quote:
Originally Posted by theducks View Post
SQL lite allows 2 dates within one field? I was looking for a second Date capable field
There ARE two date capable fields in the books table. One is called Timestamp and the other is called pubDate.
itimpi is offline   Reply With Quote
Old 04-07-2010, 08:48 PM   #20
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: 29,799
Karma: 54830978
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Thanks,
I was relying on what I thought was the current .sql create script.
Something must have come along later and added additional fields.

I will get sqllitespy
theducks is offline   Reply With Quote
Advert
Old 04-08-2010, 03:04 AM   #21
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,740
Karma: 6997045
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by theducks View Post
I am looking at the file /opt/calibre/resources/metadata_sqlite.sql and that field is not there
I assumed this was the file used to create the original (empty) DB.
It is. However, as you suspected, it isn't the end of the story. There is code in library.database and library.database2 that upgrades the database to the current version. When initializing, calibre creates a V1 database (the sql you were looking at), then upgrades it.

It is worth noting that metadata is a view, so is never ALTERed. It is simply recreated as needed.
chaley is offline   Reply With Quote
Old 04-08-2010, 09:29 AM   #22
Starson17
Wizard
Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.
 
Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
Quote:
Originally Posted by chaley View Post
I am submitting ticket with the code now.
Congratulations, that was fast! I knew you were deep into that code.

BTW, are you aware that the back yard fence needs whitewashing? If you give me your apple core, you can have that one, too.

There's a bug ticket enhancement request for remembering the regex expressions used in the Add/Save preferences when "get metadata only from filename is turned on". It would be nice for this to have a simple remembered history, like the old search history pulldown that you just rewrote. If you're up to speed on that, it might be another simple fix for you.

It's ticket #4940.
Starson17 is offline   Reply With Quote
Old 04-08-2010, 11:39 AM   #23
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: 29,799
Karma: 54830978
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 chaley View Post
It is. However, as you suspected, it isn't the end of the story. There is code in library.database and library.database2 that upgrades the database to the current version. When initializing, calibre creates a V1 database (the sql you were looking at), then upgrades it.

It is worth noting that metadata is a view, so is never ALTERed. It is simply recreated as needed.
Make sense, the upgrade method code can work correctly from almost any version to the current version this way, including an initial install. Elegant.
theducks is offline   Reply With Quote
Old 04-10-2010, 02:54 AM   #24
Sabardeyn
Guru
Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.
 
Sabardeyn's Avatar
 
Posts: 644
Karma: 1242364
Join Date: May 2009
Location: The Right Coast
Device: PC (Calibre), Nexus 7 2013 (Moon+ Pro), HTC HD2/Leo (Freda)
Before the date search programming goes too far... Just though I should question the validity of the date format. Internationally I know dates are frequently written as 10 Apr 2010 (or it's equivalent of 10-04-10). Would the search be able to account for something like this?

Last edited by Sabardeyn; 04-10-2010 at 02:57 AM.
Sabardeyn is offline   Reply With Quote
Old 04-10-2010, 03:47 AM   #25
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,740
Karma: 6997045
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
There are many date formats. I personally use all of 'd/m/y', 'd-m-y', 'd-spelled_month-y', 'd spelled_month y', 'm/d/y', 'm-d-y', and 'spelled_month d, y', and 'y-m-d'. In addition, y is 2 or 4 digits, and the spelled month might be fully spelled or abbreviated in some way.

In the end, one must either pick a format that is predictable and understandable, or suffer from mysterious conversion errors. If someone types in 10-10-10, what date is it? Using y-m-d solves the problem, and is trivially explainable.
chaley is offline   Reply With Quote
Old 04-10-2010, 05:14 AM   #26
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,853
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
@chaley: IIRC, the implemetation uses parse_date. In which case it will parse a rather wide range of date specifications.
kovidgoyal is online now   Reply With Quote
Old 04-10-2010, 05:46 AM   #27
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,740
Karma: 6997045
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by kovidgoyal View Post
@chaley: IIRC, the implementation uses parse_date. In which case it will parse a rather wide range of date specifications.
Yes it does use parse_date, which (as you are implying) means that it will make educated guesses about the date. Unfortunately, the guessing does not use the locale, so ambiguous dates are parsed as m-d-y. For example, entering 5-1-10 will result in 1 June 2010 even if the locale specifies d-m-y. This is the behavior for parsing all dates in calibre, which may or may not be a bug (I don't know).

Other than the above locale issue, the current implementation has two problems. The first is that to implement partial matching, the code must know what the date segment separator is. Currently it accepts only '-'. I will change this to accept '-' or '/' (any others?). The second is that using guessable formats will be far more likely to throw a value exception, and these currently are badly (i.e., not) handled. I will fix this as well.
chaley is offline   Reply With Quote
Old 04-10-2010, 07:14 AM   #28
DoctorOhh
US Navy, Retired
DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.
 
DoctorOhh's Avatar
 
Posts: 9,864
Karma: 13806776
Join Date: Feb 2009
Location: North Carolina
Device: Icarus Illumina XL HD, Nexus 7
Quote:
Originally Posted by chaley View Post
For example, entering 5-1-10 will result in 1 June 2010 even if the locale specifies d-m-y.
Thanks for the effort.

Did you mean for June above to be May?
DoctorOhh is offline   Reply With Quote
Old 04-10-2010, 08:01 AM   #29
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,740
Karma: 6997045
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by dwanthny View Post
Did you mean for June above to be May?
Nah. March doesn't exist in my universe.
chaley is offline   Reply With Quote
Old 04-10-2010, 11:03 PM   #30
Sabardeyn
Guru
Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.
 
Sabardeyn's Avatar
 
Posts: 644
Karma: 1242364
Join Date: May 2009
Location: The Right Coast
Device: PC (Calibre), Nexus 7 2013 (Moon+ Pro), HTC HD2/Leo (Freda)
Chaley,

I just thought I would broach the idea before any assumptions made in the programming became a problem. But you've given more thought to this than was apparent in that first post.

As to separators, I vaguely recall seeing periods used in dates, but cannot cite a specific example. I know they're used for phone numbers (for example, (123) 456-7890 == 123.456.7890).
Sabardeyn is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to remove dates from news feed vega07 Calibre 11 07-26-2010 06:25 PM
Article Dates with parse_index EnergyLens Calibre 6 04-21-2010 10:13 PM
Kindle 2 Shipping Dates Cutestory Amazon Kindle 29 02-13-2009 11:30 AM
Dates in Russian (?) Roger Wilmut Calibre 10 11-24-2008 06:22 PM
Google Book Search to search full-text books online Bob Russell Deals and Resources (No Self-Promotion or Affiliate Links) 1 08-19-2006 12:13 PM


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


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