View Single Post
Old 05-10-2016, 06:49 AM   #61
stoduk
Member
stoduk began at the beginning.
 
Posts: 18
Karma: 10
Join Date: Sep 2013
Device: Kobo Mini, Kindle Paperwhite V2
Few problems with new plugin

Hi szarroug3

As someone mentioned, there is an existing plugin (that mjwilson created, and I've been working on slowly in the background).

I thought I'd give your plugin a run to see how it compares, whether there is any point carrying on with both etc. Not really come to any conclusion on that - the Windows app is far and away the most stable and feature rich, both plugins have promise but have a lot of catching up to do.

[FWIW mine can create decent Xray files for me now, though I've really only tested with new format files. It doesn't yet create the Start/End/Author files, though I was going to add those soon]

Hit a few problems, thought I'd post them here. If you'd rather I submitted as issues on github I can do that. I've tested in two setups:
- OS X 10.10.5 with Calibre 2.56.0
- Windows 7 (under VirtualBox) with Calibre 2.56

Full gory details below. As it stands I haven't been able to get a working Xray using your plugin, but as it works for you I imagine I've got some small difference in my setup.

Cheers,
Anthony

1) Version 2.0.0 in Windows 7
"Selecting 'Book preferences" shows a dialog with only ASIN and shelfari URL (ie. missing the three buttons - search for ASIN, etc.)

2) Version 2.2.0
This is linked from github, but doesn't seem to exist!

2) Version 2.1.0 in Windows 7
a) Crash with book amazon likely doesn't know about
Spotted there was an updated version on the forum, tried this. Problem #1 now gone (fixed or hiding? You'll know more than me), but I get this error when running on Calibre's Quick Start Guide (both text boxes in dialog are empty, I assume because we are barfing trying to find the ASIN)

calibre, version 2.56.0
ERROR: Unhandled exception: <b>AttributeError</b>:'BookConfigWidget' object has no attribute '_asin_edit'

calibre 2.56 embedded-python: True is64bit: False
Windows-7-6.1.7601-SP1 Windows ('32bit', 'WindowsPE')
32bit process running on 64bit windows
('Windows', '7', '6.1.7601')
Python 2.7.9
Windows: ('7', '6.1.7601', 'SP1', 'Multiprocessor Free')
Successfully initialized third party plugins: X-Ray Creator
Traceback (most recent call last):
File "calibre_plugins.xray_creator.book_config", line 173, in search_for_asin
AttributeError: 'BookConfigWidget' object has no attribute '_asin_edit'

b) Lookup problems with A Christmas Carol/lack of error reporting
ASIN B00Q0LB318 is found (think that is coming from book as it is what I'm expecting), but the shelfari URL is 38316941. I thought things were failing here, but a little digging shows that this shelfari entry just has no details at all - so the "aliases" box is being populated with what it finds (ie. nothing!).

Some better status reporting here would go a long way - it isn't clear what happened (ie. shelfari page fetched but nothing found)

c) Fixing the shelfari URL to 4575254 (an entry with decent character data)
I edited the shelfari URL to use a better ID - but this caused Calibre to go in to extreme slow mode. A few seconds for each character press to be recognised. One time your plugin window closed without warning, the second time it worked - and I get a list of Characters to edit!

[Note: I tried to paste the URL in once, instead of typing, and that caused Calibre to lock up completely. Assume this is a similar problem]

Is your plugin doing anything while the "Shelfari URL" text box is being edited? I wonder if edit_shelfari_url() is being run with each character press - if so that could be sllllloooowww. Please don't do that, just update once the click button has been pressed (or after a few moments of inactivity)

d) Making an xray finally
The x-ray that is generated (note: I didn't edit aliases, so we've just got the default character names), and I get garbage. I'm sure Peter is a nice guy, but he really isn't a main character, and certainly he isn't mentioned 65870 times (compared to zero for everyone else!). [I'm sure when I ran this yesterday I got the same result, but with Fred getting all the action]

sqlite> select id, label, count from entity;
id label count
---------- ---------- ----------
0
2 Jacob Marl 0
3 Bob Cratch 0
4 Ghost of C 0
5 The Ghost 0
6 The Ghost 0
7 Mrs. Cratc 0
8 Tiny Tim 0
9 Martha Cra 0
10 Peter Crat 65870
11 Belinda Cr 0
12 Mr. Fezziw 0
13 Mrs. Fezzi 0
14 Ebenezer S 0
15 Dick Wilki 0
16 Fred 0
17 Jacob Marl 0
18 Joe Miller 0
19 Caroline 0
20 Topper 0
21 Belle 0
22 Fan 0
23 Almshouse 0
24 Blind man' 0
25 Humbug 0
sqlite>

e) editing aliases
I tried adding a single alias ("Scrooge" for the main character) and that had no effect - still Peter Cratchit gets all the action, as in previous case.

3) Latest github version in OS X
a) unmodified
I cloned your github and tried that out in OS X - it doesn't work, as I see mentioned in the forum. It would be a shame to not support all OS, especially when the current problem is so minor. You just need to figure out a way to look for external devices in OS X/linux - I suspect something with 'mount' would work.

b) hacked to workaround problem

4) general comments
a) error reporting
you seem to be swallowing some errors, instead of printing the original python stacktrace. eg. I think I got the "windll" assertion with the 2.0.0 version of the plugin, but I get something more cryptic with the github version (KeyError for 'send_status'). That might make debugging harder..

b) interacting with calibre DB
I had been putting this step off, as I hadn't figured out how to do it. I *think* what you are doing is considered naughty, you shouldn't be modifying the Calibre DB under the covers. I meant to start a thread on how to fix that, hopefully Kovid or other has some ideas.

[I think if a book gets renamed or deleted, you'll be leaving junk scattered around the filesystem. Not a terminal problem, but something to be aware of]

c) interacting with kindle
As with (b) I hadn't figured this out. I wondered if Kindle driver would need to be modified. Again, I was going to ask the experts.

[what you are currently doing is duplicating code from Kindle driver, but it should be harmless as you'll only be doing what I do by hand currently]

d) modifying ASIN in books directly
If I understand your code you are modifying the MOBI on the Kindle device directly to update the ASIN. This seems odd! FWIW the "Quality Check" plugin can update ASIN as needed, so might be better to just call that to fix books in the Calibre DB directly.
stoduk is offline   Reply With Quote