View Single Post
Old 04-17-2011, 12:09 PM   #11
kiwidude
Calibre Plugins Developer
kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.
 
Posts: 4,730
Karma: 2197770
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
Ok, will do. By log spam you mean "build log" when you run your tests right? Or are these functions being called from elsewhere too?

I had a struggle with setting pubdate. With Goodreads they have some very variable date formats and I have a bespoke routine that parses them and converts into a year, month, day value. I was using this in my previous plugin which worked fine:
Code:
mi.pubdate = datetime.date(year, month, day)
However it is blowing up inside identify.py as per this:
Spoiler:

Code:
calibre, version 0.7.55
ERROR: Download failed: Failed to download metadata. Click Show Details to see details

Traceback (most recent call last):
  File "D:\CalibreDev\latest\calibre\src\calibre\gui2\metadata\single_download.py", line 365, in run
  File "D:\CalibreDev\latest\calibre\src\calibre\ebooks\metadata\sources\identify.py", line 355, in identify
  File "D:\CalibreDev\latest\calibre\src\calibre\ebooks\metadata\sources\identify.py", line 250, in merge_identify_results
  File "D:\CalibreDev\latest\calibre\src\calibre\ebooks\metadata\sources\identify.py", line 99, in finalize
  File "D:\CalibreDev\latest\calibre\src\calibre\ebooks\metadata\sources\identify.py", line 144, in merge_isbn_results
  File "D:\CalibreDev\latest\calibre\src\calibre\ebooks\metadata\sources\identify.py", line 211, in merge
TypeError: can't compare datetime.datetime to datetime.date

So I changed it to this which seems to work:
Code:
from calibre.utils.date import utc_tz
return datetime.datetime(year, month, day, tzinfo=utc_tz)
I know the other plugins use parse_date, but it won't handle the parsing I have to do. Is my workaround above ok?
kiwidude is offline   Reply With Quote