ping / libby-calibre-plugin

OverDrive Libby Plugin for calibre
https://www.mobileread.com/forums/showthread.php?t=354816
GNU General Public License v3.0
75 stars 16 forks source link

Downloaded book is not recognised as being in library. #8

Closed sgmoore closed 1 year ago

sgmoore commented 1 year ago

Not sure how this plugin determines if a book already exists in the library, but it does not seem to be working for one of my books. Also it creates a new book which is not what I want it to do.

Scenario.

I start with an empty book in my library database which has the correct author name and title but does not have the ODID identifier.

I borrowed a book (manually from the library website and not using this plugin).

I open this plugin and it shows this book in my loans tab. This is correct as I have option "Exclude empty books when hiding titles already in library" ticked, so this book is not hidden.

I then use this plugin to download the book.

This creates a new book which I do not think is correct as the option 'Always download as a new book' is not ticked.

Also, the book is still not hidden, even after closing the plugin and re-opening it (and if I tried downloading it again, I would end up with a third copy).

ping commented 1 year ago
  1. Can you provide a link to the book so that I can try to replicate this?
  2. If you right click on the loan and click on the "Search in calibre library", does it find the book?
sgmoore commented 1 year ago
  • Can you provide a link to the book so that I can try to replicate this?

https://librariesniuk.overdrive.com/media/863343

  • If you right click on the loan and click on the "Search in calibre library", does it find the book?

Yes. It finds the book, even when I delete the downloaded copies leaving just the original empty entry.

I think I have been able to figure out a little bit more of what is going on.

Once we have a two records then the test to see if a book should be hidden only looks at the first match and then checks to see if it is an empty book but does not look at the second entry.

I think

https://github.com/ping/libby-calibre-plugin/blob/9cc6d435d71a7c809f071cfc07632a1ab790b8d0/calibre-plugin/models.py#L489

should be

         else :
             break  # check only first matching book

That doesn't explain why it creates a new book in the first place.

ping commented 1 year ago

If I guessed right, the empty book you have does not contain any identifiers (for example, ISBN). The plugin was relying only on matching IDs and did not look at the title to decide when to update an empty book.

This should be fixed now, and if you want to try it out, download and install this version.

sgmoore commented 1 year ago

That works perfectly - Thank you very much.

Actually the book did have an isbn, but looks like it was a different one from the version on libby.

I had 9781848879911 whereas the libby version is 9780857894465 - they both refer to the same book, just published by different publishers at different times.

Thanks again