I'm working on one last (cough) addition to the Goodreads sync plugin before I release it, and that is adding the ability to create an action which sets a datetime custom column using either a value from the Goodreads API xml or the current timestamp. So for instance someone who wants a custom column in Calibre representing the date they last read the book could get that value populated by syncing from their Goodreads shelf.
The bit I would appreciate help with is the datetime parsing, and getting a value in the right format to pass to db.set_custom().
Goodreads will supply values in their xml API that look like this:
Code:
<date_added>Mon Feb 21 03:48:31 -0800 2011</date_added>
<date_updated>Mon Feb 21 03:48:31 -0800 2011</date_updated>
<started_at/>
<read_at/>
Could anyone (and yeah it's probably you chaley as Mr Custom Column
) please tell me:
1. What I need to do to convert a variable holding one of those text dates into a value I could pass to db.set_custom()?
2. What I should pass to use a current timestamp?
3. If I were to call db.get_custom() to compare values before deciding to update, what tricks if any I may need to check for equality?
Many thanks