View Single Post
Old 12-25-2010, 09:02 PM   #18
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 8,809
Karma: 6000000
Join Date: Nov 2009
Device: many
Hi,

Forgive me if I am messed up as I am new to this code but I think metadata.archive falls back to metadata.zip if there is no known type inside the archive (unless a comic).

And it looks like metadata/zip.py already will detect an .opf file if inside the zip and will invoke meta.get_metadata(stream,'opf') which in turn will invoke opf_metadata(path) which will parse it properly including the cover information from the manifest and the guide.

The issue is that since libprs is not forced to be True and application_id is None since this book is not part of calibre yet), meta.get_Metadata(stream,stream_type) will not return the opf information just collected, but will instead try to drag meta information from the filename and just before returning will do a base.smart_update(opf) with the opf meta information.

The issue is that opf.smart.update() will not update the cover or cover_data attributes as they are not on the list of attributes it will try to smartly update.

Unless this would mess you up, the easiest fix would be to do something along these lines (I think)

--- opf2.py 2010-12-23 16:39:20.000000000 -0500
+++ opf2_new.py 2010-12-25 20:47:37.000000000 -0500
@@ -990,7 +990,7 @@
for attr in ('title', 'authors', 'author_sort', 'title_sort',
'publisher', 'series', 'series_index', 'rating',
'isbn', 'tags', 'category', 'comments',
- 'pubdate'):
+ 'pubdate', 'cover', 'cover_data'):
val = getattr(mi, attr, None)
if val is not None and val != [] and val != (None, None):
setattr(self, attr, val)


Am I understanding this correctly?
KevinH is offline   Reply With Quote