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

Series tab blank - Unhandled exception in getSeries #1536

Closed wizzy99 closed 6 years ago

wizzy99 commented 6 years ago

To help with identifying and fixing issues, please include as much information as possible, including:

LazyLibrarian version number (at the bottom of config page)

9bdc7a4c844ab7eaaeb3f17fb3faa788254334da

Operating system used (windows, mac, linux, NAS type)

fc28

Interface in use (default, bookstrap)

bookstrap

No sure when this started, but I don't get any info displayed when clicking on the Series tab. The log shows the following:

08-Aug-2018 13:18:50 - ERROR :: WEBSERVER : webServe.py:getSeries:757 : Unhandled exception in getSeries: Traceback (most recent call last): File "/app/lazylibrarian/lazylibrarian/webServe.py", line 742, in getSeries filtered.sort(key=lambda y: (-int(y[8]), int(y[7]))) File "/app/lazylibrarian/lazylibrarian/webServe.py", line 742, in filtered.sort(key=lambda y: (-int(y[8]), int(y[7]))) TypeError: int() argument must be a string or a number, not 'NoneType'

sqlite> select count(*) from series; 13899

Not sure if it's related, but I also see errors about a mismatch when updating an author. As an example: :07-Aug-2018 16:58:04 - WARNING :: EBOOK_SCAN : bookwork.py:getWorkSeries:839 : Name mismatch for series 147914

philborman commented 6 years ago

Name mismatch is because goodreads is giving us different information for different books in the series. It's just a warning, hopefully over time they will fix their metadata. It's things like Lonely Planet City Guides, some books at goodreads have the series name as "City Guides" and some as "City Guide"

The unhandled exception is a bug, we are trying to sort the series on percentage complete, but for one or more series we don't have the right values for the number of books in the series, or the number of books you have. Shouldn't really happen, and needs fixing... For now do you know how to use the api? If you use the api command "deleteEmptySeries" I think the problem should go away.

wizzy99 commented 6 years ago

Ran deleteEmptySeries and the count in the table is the same. The screen showed a 0 as the result. Nothing in the log beyond invoking the api.

08-Aug-2018 14:16:56 - DEBUG :: API : api.py:fetchData:227 : Received API command from x.x.x.x:5299: deleteEmptySeries {}

Same error in the log: 08-Aug-2018 14:25:37 - ERROR :: WEBSERVER : webServe.py:getSeries:757 : Unhandled exception in getSeries: Traceback (most recent call last): File "/app/lazylibrarian/lazylibrarian/webServe.py", line 742, in getSeries filtered.sort(key=lambda y: (-int(y[8]), int(y[7]))) File "/app/lazylibrarian/lazylibrarian/webServe.py", line 742, in filtered.sort(key=lambda y: (-int(y[8]), int(y[7]))) TypeError: int() argument must be a string or a number, not 'NoneType'

philborman commented 6 years ago

ok, thanks. You could fix it with a simple sqlite command, but I've just fixed it for real in the next release by setting a default value of zero for the column. Should be out later tonight or tomorrow.

wizzy99 commented 6 years ago

Thanks. I do see lots of rows with missing data.

sqlite> select count(*) from series where total is null and have is null; 10262

I deleted the garbage rows: sqlite> delete from series ...> where total is null and have is null; sqlite> select count(*) from series; 3637

and now the series tab is working.

philborman commented 6 years ago

Yes, it wastotal is null that caused the problem. We converted have/total to integers (default 0) to work out the percentage of the series that you have got, and then tried to sort the list with percentage as first sort, and total as second - that part failed if total was null instead of zero and we hadn't saved the converted value.

New database table stores haveand total as integers with a default of zero so can never be null.