View Single Post
Old 05-09-2011, 08:48 AM   #1
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,733
Karma: 2197770
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
Metatdata API - prioritising results

Having spent about 3 hours of adding print statements and tracing through this code I am pulling my hair out so perhaps (most likely Kovid) can enlighten me.

I have a book which returns three ISBN matches from B&N:
9781101135570
9780451229939
9780594256113 - has no cover

These results then get sorted by the InternalMetadataCompareKeyGen to:
9780451229939
9781101135570
9780594256113

All good so far - the results are sorted in order of "preferred match".

Then the lookup via XISBN takes place, and it finds the ISBNs ending in 939/570 are in the same "pool". So it takes the first result and discards the second. So now we have:
9780451229939
9780594256113

Now the final merge takes place. HOWEVER the merge of identifiers in ISBNMerge.merge() is done by this code:
Code:
        for r in results:
            ans.identifiers.update(r.identifiers)
Which effectively says take the LAST isbn value from the results it is given, as each "update" will overwrite the ISBN set previously?

So now my final result being given back is given the ISBN of 9780594256113 - which is the ISBN that does NOT have a cover, and is my least preferred match.

Is this a bug or am I missing something?
kiwidude is offline   Reply With Quote