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

Clicking on "ebooks" caused LibraryThing overlay #1545

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)

bbb36a41779e0a68958c54ccb3dc26749490c143

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

linux

Interface in use (default, bookstrap)

bookstrap

When I click on the ebooks icon in the header, I get a LibraryThing overlay.
https://imgur.com/a/icA9xCK

The LibraryThings icons (Home/Groups/Talk/Zeitgeist) use the same IP as my LL installation, but without the /lazylibrarian suffix.

philborman commented 6 years ago

Can't reproduce it here. If you hover over the ebooks icon on chrome or firefox you should get a popup giving the address the link goes to, on mine it looks like this... image does that look the same on yours or are we missing the /lazylibrarian part? also is it just ebooks or does it also not work from the other icons (series, audiobook etc)

wizzy99 commented 6 years ago

The hover has the right url (/lazylibrarian) for eBooks. Here's a video of me clicking on each of the buttons at the top. http://recordit.co/PEPF4Hlxzo

philborman commented 6 years ago

Well it's certainly odd. What happens if you feed the url straight into the browser, something like http://localhost/lazylibrarian/books does the right page appear then?

wizzy99 commented 6 years ago

Same thing. Opened new tab, pasted books url, pulls up the librarything overlay.

philborman commented 6 years ago

So somehow the cherrypy server is giving the wrong page back. Is the "books.html" page ok? maybe a corrupt file? Was it working on previous releases or is it a new problem? Really puzzled!!!

wizzy99 commented 6 years ago

It used to work, but I noticed this start happening sometime in the last couple of weeks.

LL said my version was up to date, but from the command line I did a git pull and got a bunch of updates; unfortunately that didn't resolve the issue. Restarted LL, and still not working.

I've attached my books.html file. books.html.txt

philborman commented 6 years ago

books.html looks fine, wouldn't be that simple, would it ;-) There were some updates today, which you probably now have, and some updates 9 days ago. I'm guessing the problem was in that update, but nothing leaps out as to why, and it could be hard to track down as I can't reproduce it. I will have a dig around the changes 9 days ago in more detail.

wizzy99 commented 6 years ago

Getting weirder. I've now lost the links to GoodReads and LibraryThing under each book. Was that part touched today?

philborman commented 6 years ago

Yes it was, hadn't noticed that. Moved the button generation code from python into javascript. Expect a fix shortly.

philborman commented 6 years ago

ok, links are back now. Still no idea what's going on with the librarything overlay though.

philborman commented 6 years ago

Still looking into this. Can you try enabling user accounts in config, set log level to 8192 and click on a few of the buttons. You should see lines in the log like this... 24-Aug-2018 14:16:34 - DEBUG :: WEBSERVER : webServe.py:serve_template:147 : User admin: 65535 series.html 24-Aug-2018 14:16:41 - DEBUG :: WEBSERVER : webServe.py:serve_template:147 : User admin: 65535 audio.html 24-Aug-2018 14:16:50 - DEBUG :: WEBSERVER : webServe.py:serve_template:147 : User admin: 65535 books.html

If you haven't enabled user accounts before you will get a default admin user created with name and password "admin" or if you use webserver auth you will get an admin account with the same credentials as the webserver user.

Does the "books.html" line appear in your log, or are we not getting that far?

wizzy99 commented 6 years ago

24-Aug-2018 08:29:19 - DEBUG :: WEBSERVER : webServe.py:serve_template:145 : User admin: 65535 audio.html 24-Aug-2018 08:29:22 - DEBUG :: WEBSERVER : webServe.py:serve_template:145 : User admin: 65535 series.html 24-Aug-2018 08:29:25 - DEBUG :: WEBSERVER : webServe.py:serve_template:145 : User admin: 65535 books.html 24-Aug-2018 08:29:28 - DEBUG :: WEBSERVER : webServe.py:serve_template:145 : User admin: 65535 index.html 24-Aug-2018 08:29:30 - DEBUG :: WEBSERVER : webServe.py:serve_template:145 : User admin: 65535 logs.html

philborman commented 6 years ago

ok thanks. Need to think about this.

philborman commented 6 years ago

Do you mind trying something for me, I can't find the problem but as we seem to be trying to generate the template inside lazylibrarian I'm wondering if we are somehow getting the wrong template file. Could be it's cached by cherrypy webserver and somehow we are getting the wrong info. Maybe because the LibraryThing file is also called books.html and there is a cached copy of that in the same cache folder?

Can you try renaming books.html to something else, say xyz.html and editing webServe.py to look for the new name instead, line 1580 templatename="books.html", change that to "xyz.html" and see if the problem goes away. This is with user accounts turned OFF. If the problem goes away we still need to find a "proper" fix, if the problem persists I need another rethink. Maybe you could also add a line just above line 84 return template.render(perm=lazylibrarian.perm_admin, kwargs) saying logger.info(template.render(perm=lazylibrarian.perm_admin, kwargs)) so we can check the template looks ok, but only if the rename doesn't fix it.

wizzy99 commented 6 years ago

Rename had the same result, here's the log snippet when dumping the template.
template.log

philborman commented 6 years ago

Well, that was useful, thanks. Seems we have a book with a language that is incorrect (html instead of a language code). Should be simple enough to fix. We try to put the possible languages in a dropdown filter box, and should probably reject ones that don't look right. Nothing to do with recent updates, just coincidence.

wizzy99 commented 6 years ago

I cleared the "bad" HTML language from the one book and things look normal again. While I was looking for that bad record, I also saw non-numeric books ID's, which surprised me. Is that because they were sourced from somewhere other than goodreads? Some examples:

BjQEaAEACAAJ EJVomQEACAAJ MBiUmAEACAAJ N8FlAAAACAAJ N9oTnwEACAAJ QFh7rgEACAAJ QzSkDAEACAAJ VpqvtgAACAAJ XMRgqPVzX-oC aVjurQEACAAJ i2UxDwAAQBAJ nhdTLwEACAAJ q-iFkQEACAAJ qLmxoAEACAAJ vdPBAQAACAAJ x-1BngAACAAJ yuq8nQAACAAJ

wizzy99 commented 6 years ago

To answer my own question, those all came from google.

philborman commented 6 years ago

Yes, google uses alphanumeric bookids, mostly 12 character, occasionally longer. goodreads uses purely numeric bookids. I will add some code to reject invalid languages (probably just check length < 10 or is only alpha and - ) which should solve it.