View Single Post
Old 12-26-2014, 04:48 AM   #4
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,460
Karma: 8025600
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
This is interesting.

Calibre contains a dictionary "field_metadata" that contains descriptions of every field (column) in the library. It is supposed to contain only metadata, not values of the fields. Unfortunately the description of the field #kobolastread has had a value inserted, which is never supposed to happen. You can see this by looking at the field metadata section of metadata_db_prefs_backup.json.

I don't know how one goes about inserting a value into field_metadata. The only way I can find to do it is something like:
Code:
  fm = field_metadata.get('#kobolastread')
  fm['#value#'] = something
In this case 'something' is a JSON-encoded datetime value that looks like:
Code:
     {
        "__class__": "datetime.datetime", 
        "__value__": "2014-12-22T23:47:57+00:00"
      }
so perhaps the code looks like
Code:
  fm = field_metadata.get('kobolastread')
  json_encoded = JsonCodec().encode_book_metadata(book)
  fm['#value'#] = json_encoded['#kobolastread']['#value#']
Does the problem go away if you start calibre then connect CC without having connected your kobo?
chaley is offline   Reply With Quote