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

Force image refresh #503

Closed ezar closed 8 years ago

ezar commented 8 years ago

Hi, I want to refresh images because after latest update, it disappeared. Can you help me?

image

philborman commented 8 years ago

That's interesting, but not in a good way!

You can refresh the images using the api, but you shouldn't really need to. There was a database update as part of this release and it seems that's not worked properly. Would be good to track down why, but I would need some help.

What operating system are you on (windows, mac, linux)

Do you have access to a python prompt so you can enter a few commands to investigate this?

If so, and you don't mind helping, I can send you a few commands to try and find out what's happened. Might also mean we can get your images back quickly.

If you just want to get up and running you can use the api to reload images from the internet, but this can take a while, and the images are already there on your system, just not linked in properly.

Api commands:

Use your browser to get to the lazylibrarian config page, eg http://192.168.2.2/lazylibrarian/config

On there you can enable api, which will show an api key

In the browser bar, change the /config part to /api?apikey=whateveryourapikeyis&cmd=help

This will show a long list of available commands, just to check you are talking to the api correctly.

Now run these commands in order. Each will report "ok" when completed. The first one might take a minute or two, the second one might take a lot longer depending how many books are in your database. The third one is quicker. When it says "ok" you should have all your book and author images back

/api?apikey=whateveryourapikeyis&cmd=cleanCache&wait

/api?apikey=whateveryourapikeyis&cmd=getBookCovers&wait

/api?apikey=whateveryourapikeyis&cmd=getAuthorImages&wait

On 16/10/16 07:58, ezar wrote:

Hi, I want to refresh images because after latest update, it disappeared. Can you help me?

image https://cloud.githubusercontent.com/assets/42736/19415628/2542c040-9376-11e6-8e52-3ad085cb9fb2.png

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/DobyTang/LazyLibrarian/issues/503, or mute the thread https://github.com/notifications/unsubscribe-auth/ALmHOYLSxJOs0nsR5xZn1YgAbcGxqNEGks5q0bzvgaJpZM4KX5i9.

ezar commented 8 years ago

I can help you!

What operating system are you on (windows, mac, linux) Linux.

Do you have access to a python prompt so you can enter a few commands to investigate this? Yes.

Please send me the commands :)

philborman commented 8 years ago

Excellent, thank you. First, can you check where the .jpg files are to see if we moved them correctly.

Example below assumes your lazylibrarian installation is in /opt/Lazylibrarian and you are using the default location for datadir. If not you will need to adjust the paths.

The cache used to be here... ls /opt/LazyLibrarian/data/images/cache/*.jpg (should be empty, so reports no such file or directory)

and is now here (or wherever datadir points to) ls /opt/LazyLibrarian/cache/*.jpg (your jpg files should be in here)

Next check the database. At a terminal, type sqlite3 /opt/Lazylibrarian/lazylibrarian.db

All sqlite3 commands have a semicolon on the end

in sqlite3, sqlite> PRAGMA user_version;

should report either 7 or 8 (8 is current version, 7 is old version so update failed)

Finally, in sqlite3, sqlite> select bookimg from books;

should report lots of names like cache/123545.jpg and not images/cache/12345.jpg

To exit sqlite3 just close the terminal or use the .quit command (starts with a period, no semicolon on the end)

Thanks!

On Sun, 16 Oct 2016 at 14:55 ezar notifications@github.com wrote:

I can help you!

What operating system are you on (windows, mac, linux)

Linux.

Do you have access to a python prompt so you can enter a few commands to investigate this?

Yes.

Please send me the commands :)

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/DobyTang/LazyLibrarian/issues/503#issuecomment-254045343, or mute the thread https://github.com/notifications/unsubscribe-auth/ALmHOR1k_KGqWIkliu3RkOezQkoOr-7Iks5q0h7SgaJpZM4KX5i9 .

ezar commented 8 years ago

ls /opt/lazylibrarian/data/images/cache/*.jpg Many files here.

ls ~/.lazylibrarian/cache/*.jpg only 3 files.

sqlite> PRAGMA user_version; 8

sqlite> select bookimg from books; 77 rows returned in 0ms from: select bookimg from books; All rows, cache/*.jpg

Regards,

philborman commented 8 years ago

ok, good news. It correctly updated the database entries, moved the first few files, but failed to move them all. Easy fix for you,
in a terminal, mv /opt/lazylibrarian/data/images/cache/*.jpg ~/.lazylibrarian/cache/

The problem is (probably) a missing image file in the cache so the "move" routine fails. I have added a bit more code to trap this and continue, after issuing a warning. Let me know if this fixes it for you :-)

ezar commented 8 years ago

Works!!! thanks

philborman commented 8 years ago

No problem. Thanks for helping. I will push the update with extra error trapping now I know that's ok.

On Sun, 16 Oct 2016 at 19:33 ezar notifications@github.com wrote:

Works!!! thanks

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/DobyTang/LazyLibrarian/issues/503#issuecomment-254060981, or mute the thread https://github.com/notifications/unsubscribe-auth/ALmHOcUkXfLADEtqB-Z008HeCXzRIxd3ks5q0l_tgaJpZM4KX5i9 .

yabdali commented 6 years ago

/api?apikey=whateveryourapikeyis&cmd=getBookCovers&wait

Running the 2nd command via API /api?apikey=whateveryourapikeyis&cmd=getBookCovers&wait resulted in this error! Not sure if its caused by some deletion I did to the books table via Sqlite for items with status ="Skipped". I had 1000s of books added for the authors I have in LL, books other than the ones I have in my Goodreads lists. capture

philborman commented 6 years ago

Looks like an odd error, not seen that before. Are you up to doing a little editing to track it down? Would need an extra debug line adding in the images.py file to pin down exactly what's going on. If not I can push a version with some debugging for you?

yabdali commented 6 years ago

Looks like an odd error, not seen that before. Are you up to doing a little editing to track it down? Would need an extra debug line adding in the images.py file to pin down exactly what's going on. If not I can push a version with some debugging for you?

I would certainly love to help providing extra feedback. Let me know if I should make any change to the config file to enable debugging of such error.

philborman commented 6 years ago

It is a change needed to images.py Not sure how much python you know, but it's very fussy about whitespace. Keep a copy of the unchanged images.py so you can replace it after testing. Use spaces to indent the new line so it is directly level with the one below, do not use tab lines 85 and 86 are

             if coverlink and "nocover" not in coverlink:
                controlValueDict = {"BookID": bookid}

Between those lines add a log line so it says

             if coverlink and "nocover" not in coverlink:
                logger.info("%s [%s]" % (type(coverlink), coverlink))
                controlValueDict = {"BookID": bookid}

It will probably still throw the same internal server error but should show what's going on. Restart lazylibrarian, run the api command to cause the error, post the log info line here, then replace the old images.py and restart lazylibrarian. Thanks,