DobyTang / LazyLibrarian

This project isn't finished yet. Goal is to create a SickBeard, CouchPotato, Headphones-like application for ebooks. Headphones is used as a base, so there are still a lot of references to it.
728 stars 72 forks source link

added Goodreads Wishlist name as metadata tags when importing into Calibre #1608

Closed jcal22 closed 5 years ago

jcal22 commented 5 years ago

I have multiple Wishlists in LazyLibrarian. This code adds the displayname as a tag in Calibre on import. It's currently setup for Goodreads because that is what I use, but could be ported to other providers.

In case, it is on multiple lists, it will add display names to the tags until it is imported.

Change requires adding a field to books table in database. I added Requestor as a text field in my db to make it work, but I don't know how to programmatically add that field. I added it manually.

There probably needs to be a config that enables it or not, but I was checking the interest level in adding this to the main repository befored I add in stuff I won't use.

philborman commented 5 years ago

Looks good. Neat idea, I'm wondering if we need two extra fields in the db, one for ebooks and one for audiobooks, or can we share the one field and call it "tags" so it's multipurpose If we only need the field(s) once would it be better to add it to the history table rather than the book table. History table only creates an entry for each book we download, and user can safely delete the history entry after importing into calibre. What do you think?

jcal22 commented 5 years ago

I think two variables would be best. The history table sounds like a better idea as well since it's only adding the tags on download. Is updating the db file trivial for the program? I'm interested in seeing how that works. Is that in the lazylibrarian.py file somewhere?

Also, can I update this pull request with new code, or will it take another pull request with the finished code? This is my first contribution using github.

philborman commented 5 years ago

I think you can just update your pull request and the alterations get merged in. Not entirely sure, I haven't done it before.

The database upgrade code is in dbupdate.py. there are several previous updates that add database columns if you want to try. If not I am back home later and can take a look

jcal22 commented 5 years ago

After looking at the code, I don't see a good way to add wishlist dispname to the wanted table (there is no history table, but the history tab appears to be showing data from wanted). I'm by no means an expert, but it looks like the process for wishlist checks to see if the book exists in books and is marked as wanted. If it isn't it adds book to books as wanted. That seems to be when the program has access to rss info.

We should definitely separate the tags for audiobook and ebook. I'm open to ideas of how to get the info to the wanted table, but if not, think it should stay on books. If it stays on books, the tags could be updated on searchrss. That would allow longer term management of tags metadata for calibre which could be pushed to LL's opds implementation as more category searches. When someone adds/removes the book from their wishlist and the book is in open state, it could call calibredb to update metadata tags.

philborman commented 5 years ago

We could add the rss info alongside the downloader info in the history/wanted table. When the wishlist processor adds the book to "Wanted" we can also store why we wanted it, ie which wishlist it was found in. Maybe two columns for tags/audiotags? Wouldn't work for books already in the database, whereas adding tags to "books" table in searchrss could add tags to existing entries, so if a book you have already got appears in a wishlist you can still tag it. Probably better that way, more flexibility.

philborman commented 5 years ago

Looks good. I have merged it into my branch and will merge that into master in a couple of hours. There are some merge conflicts as I have also made changes to dbupgrade for emailing to kindle. Just need to test a bit more first, and run through pycharm. Thanks for the new feature!