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.
730 stars 70 forks source link

Manually Import #1372

Closed mccorkled closed 6 years ago

mccorkled commented 6 years ago

I have sourced a bunch of books that my indexers were not grabbing. How can I import them into LL so that it can post process them properly? I set the 'Alternate Import/Export Folder:' path but when I look at the log it states that no books were marked at snatched and therefore post processing has stopped.

Thanks!

philborman commented 6 years ago

Put the books into alternate import with each book in a separate folder and on lazylibrarian manage page click the [import books] or [include books] button. Both will add authors and books to the database. Import moves the books into your lazylibrarian library folder, Include leaves the books where they are and just tells lazylibrarian where to find them. Import will copy or move the originals in the alternate import folder depending on whether"keep original files" button is set.

mccorkled commented 6 years ago

I am getting an error about the directory not being configured, but I have the path set correctly. Any ideas?

2018-05-02 08:00:10 | WARNING | IMPORTALT | postprocess.py | processAlternate | 74 | Alternate Directory not configured

philborman commented 6 years ago

The message means that either Alternate Import/Export Folder in lazylibrarian config->processing is blank, or the name there is not a valid directory

mccorkled commented 6 years ago

Thank you. I did not have the path right within Docker. Is there a way that you could have LL search a completed folder for finished downloads? Radarr which is a similar program for movies has this feature.

This is beneficial because you can map one folder IE "downloads" and it knows when the download is complete and moved to "downloads/complete"

As of now I have downloads/complete mapped as well as downloads/manual for manually importing. If just /downloads could be mapped, within LL I could use paths right from the "download" folder rather than several individual paths.

Thank you.

philborman commented 6 years ago

You can query the downloaders for progress info, which I think is the way Radarr/Sonarr know when a download is complete. We currently only check every few minutes for completed downloads as ebooks are usually quite small and download in a few seconds, compared to movies/tv which could take hours. You can get lazylibrarian to monitor multiple folders for downloads, by putting a comma separated list of folders in lazylibrarian config Download Folders

mccorkled commented 6 years ago

So if I map only /Downloads in Docker, within LL I can put in /downloads/complete for monitoring? Also downloads/manually for manual import?

Thanks

philborman commented 6 years ago

Yes, should work. Let me know if not

mccorkled commented 6 years ago

I am having an issue with a few books not manually importing. Could you please help with this? Perhaps a physical import button where you can browse to the book would be helpful for stubborn books.

Thanks

lazylibrarian.log debug.zip

philborman commented 6 years ago

Problem seems to be goodreads doesn't know about those books, or has a different interpretation on the name. Can't really do this automatically, I think it needs manual tweaking...

George Orwel should be George Orwell and then 1984 would be imported ok. Dale Carnegie & Associates needs changing to Dale Carnegie The Isa Chandra Moskowitz book and the Nisha Patel book will both match if you drop your percentage to 86 as the titles are not similar enough. Problem in both is the colon which is used by goodreads to separate title from subtitle

If you don't already have the books or the authors in your database, import the authors using the search button top right, that will make sure you get the right author. Then do a manual search for the book from the authors page and click the one you want to download. That will associate the download with that database entry even if the names are not quite the same.

mccorkled commented 6 years ago

I am not sure where you are getting those names from, but they are labeled right in my folder and they are definitely in the database. If there would be a way to manually link a book I have downloaded to one in the database that would be great. The manual option if ok if a book is found, but if one is sourced elsewhere it would be useful to use explorer to navigate to the book for importing.

philborman commented 6 years ago

Those are the names in the logfile, could be they are from the book metadata as we prefer to use metadata rather than filenames if possible. More likely to be right. I will look into manually linking to a book, how to go about it. In the meantime you could create an opf file with author and title in it so it matches the database? We allow data in an opf file to override embedded metadata.

mccorkled commented 6 years ago

I am unsure how to do that but I will do some research. Thanks!

philborman commented 6 years ago

Ok, seems it's not possible to browse the filesystem from html, it's seen as a security risk so there are no libraries that can do it, so we can't let the user browse for a book to associate with a library entry.

There are a few options...

  1. Look for an existing opf for one of your other books and copy/edit that. We only need author name and book title, but can use isbn and language if they are included. Opf file must be named exactly the same as the book file but with .mobi extension (or .epub) replaced by .opf
  2. If you use calibre, edit the metadata from inside calibre, that will create an opf file for you, but that will be named metadata.opf so needs renaming afterwards.
  3. Cheat. Use the lazylibrarian bookid instead. If the book is listed in the lazylibrarian database, its bookid can be found by hovering over the "manual" edit button, most browsers will display the bookid in a popup. If not, click the manual button and the bookid will be in the address bar. Once you know the bookid, just move the complete book folder into lazylibrarian download_dir (normal download directory, not alternate download) and rename the folder so it ends with LL. and the bookid in braces like this... /Downloads/George Orwell 1984 LL.(123456)/ where 123456 is the bookid. The postprocessor will ignore the metadata and the folder/filenames and import the book as if it was snatched for bookid 123456

If the book doesn't exist in the database there is nothing we can do except wait for GoodReads to include it. Might be feasible to add a manual entry to the database, not straightforward though.

mccorkled commented 6 years ago

Hmmm. Well option 3 is a bit annoying, but it works. I appreciate the many times you have helped me. It would be interesting and potentially problem solving to understand why it is happening. The error states it cannot find the ebook(s) but they are titled as they are in the database and the right format. I had to reset my Calibre database the other day and so I imported all of my books through LL again. This time it didn't properly import about 10 books.

philborman commented 6 years ago

As an example in your log earlier in this thread you got...

06-May-2018 16:54:40 - DEBUG   :: IMPORTALT : postprocess.py:processAlternate:123 : No metadata file found for /downloads/manually/1984/1984.epub
06-May-2018 16:54:40 - DEBUG   :: IMPORTALT : postprocess.py:processAlternate:158 : ALT: Author George Orwel found in database
06-May-2018 16:54:40 - DEBUG   :: IMPORTALT : librarysync.py:find_book_in_db:170 : Searching database for [1984] by [George Orwel]

so there is no metadata file with the book, we read metadata from the epub file and the embedded author name is wrong, should be ORWELL not ORWEL. The book filename only has the title, not the author, so the metadata is the only place we could have got the author name from. You can correct the authorname in calibre. Unfortunately goodreads has an author with that incorrect authorname (someone entered it wrong), so we try to import using that.

After that we search for all books by that author in our database and try to match the book title using fuzzy logic. Well, we try an exact match first as a shortcut, and if that fails we try the fuzzy logic...

06-May-2018 16:54:40 - DEBUG   :: IMPORTALT : librarysync.py:find_book_in_db:206 : Searching 1 book by [George Orwel] in database for [1984]
06-May-2018 16:54:40 - DEBUG   :: IMPORTALT : librarysync.py:find_book_in_db:262 : Fuzz failed [George Orwel - 1984] ratio [0,], partial [0,], partname [0,]

Didn't find it. Three percentages are all zero. First one is "ratio" which allows "Lord Of The Rings, The" to match "The Lord Of The Rings" (100%) Second is "partial" which allows "Lord Of The Rings" to match "The Lord Of The Rings" (98%) Third is "partname" which allows "Lord Of The Rings (illustrated edition)" to match "The Lord Of The Rings" (96%) We get a percentage match and prefer a "ratio" match if the score is over a threshold value, if not try a good enough "partial" match, and finally a "partname" match but that has a higher threshold to pass as we are discarding some information in the comparison.

If you run with loglevel 3 lazylibrarian will report each book it tried to match against, and the percentage for all 3 comparisons

philborman commented 6 years ago

Just added some code to do a fuzzy match on the author name if no exact match found. If you have George Orwell in your database and the book says it's George Orwel we should match properly now. You will need to delete the "wrong" George Orwel author from your database first though.

mccorkled commented 6 years ago

The database has the right name, that's why I am a bit confused on why the matching wasn't working. Using the cheat method worked great though. I will continue to mess with this over the weekend to see if anything changes. Thanks again for your constant support.