szarroug3 / X-Ray_Calibre_Plugin

X-Ray Creator plugin for Calibre
http://www.mobileread.com/forums/showthread.php?t=273189
GNU General Public License v3.0
57 stars 12 forks source link

Issue #5 also present if book config isn't edited first #13

Closed stoduk closed 8 years ago

stoduk commented 8 years ago

The fix for #5 works if we are doing what I thought was a normal path (get ASIN, lookup in shelfari, edit aliases and then parse the book), but it seems you can go straight to parsing the book (by skipping the "book specific preferences" option and going straight for "create/update xrays").

A very similar bug is present there, in a different code path. Similar setup - ShelfariParser isn't setting up any aliases, so we set self._aliases[character_label] = "" with the result that once again in BookParser we'll end up with one character (the last one parsed in BookParser.init) being the one with "" as its alias - and so having a very large number of matches against it (any time we have a single space character between two word boundaries).

See logs below - first two are from running the "create/update xrays" on the two books without first going via "book specific preferences", both of these are broken. The third log is from when I go to "book specific preferences", click the third button, hit ok, then do "create/update xrays" - in this path the aliases are being populated from the fix I made for issue #5, while in the previous two cases this path isn't hit so things are broken still.

Book._parse_shelfari_data:
{1: {'description': 'Main character and narrator of story.  Tired of his mundane life, seeking a change and a human connection.', 'label': 'The Narrator'}, 2: {'description': 'Anarchist and primitivist that starts Fight Club and leads the narrator into the darker side of life.', 'label': 'Tyler Durden'}, 3: {'description': "Narrator meets her at support groups. She later becomes Tyler Durden's mistress/girlfriend.", 'label': 'Marla Singer'}, 4: {'description': 'Former bodybuilder who meets the narrator at a support group for Testicular cancer.', 'label': 'Robert "Big Bob" Paulson'}, 5: {'description': "Space monkey. Gets the nickname for having a 'beautiful' face.", 'label': 'Angel Face'}, 6: {'description': 'A girl in the parasite support group that the narrator attends.', 'label': 'Chloe'}, 7: {'description': 'Host of a dinner party where Tyler works as a server.  Married to Madam.', 'label': 'Albert'}, 8: {'description': None, 'label': 'Tasha Black'}, 9: {'description': 'A rich woman throwing a dinner party that Tyler works at as a waiter.', 'label': 'Madam'}, 10: {'description': 'Store employee whose life is undeniably changed by and encounter with Tyler Durden.', 'label': 'Raymond K. Hessel'}, 11: {'description': None, 'label': 'Leslie'}, 12: {'description': None, 'label': 'Mrs. Patrick Madden'}, 13: {'description': None, 'label': 'Joe'}, 14: {'description': None, 'label': 'Patrick Madden'}, 15: {'description': None, 'label': 'Walter'}}
{16: {'description': 'A fictional building in the novel, the "tallest building in the world".', 'label': 'Parker-Morris Building'}, 17: {'description': "The dilapidated house on Paper Street is Tyler Durden's house. The narrator moves into the house after his condo is destroyed by an explosion. The house is practically condemned. The only neighbors are a closed machine shop and a block-long warehouse. A past tenant collected magazines, so there are stacks piled high in the basement and almost every room. The house becomes the headquarters and training ground for Project Mayhem members.", 'label': 'The Paper Street House'}, 18: {'description': 'Noted support groups in the story include Remaining Men Together (the testicular cancer group), Free...', 'label': 'The Support Groups'}, 19: {'description': None, 'label': 'Project Mayhem'}, 20: {'description': None, 'label': 'Ireland'}, 21: {'description': None, 'label': 'Seattle'}, 22: {'description': None, 'label': 'Dulles'}, 23: {'description': None, 'label': 'Chicago'}}
self._aliases before: {u'Tyler Durden': [u''], u'Walter': [u''], u'Dulles': [u''], u'The Paper Street House': [u''], u'Chloe': [u''], u'Albert': [u''], u'Angel Face': [u''], u'Leslie': [u''], u'Robert "Big Bob" Paulson': [u''], u'Madam': [u''], u'Joe': [u''], u'Raymond K. Hessel': [u''], u'Marla Singer': [u''], u'The Support Groups': [u''], u'Parker-Morris Building': [u''], u'Chicago': [u''], u'Project Mayhem': [u''], u'Mrs. Patrick Madden': [u''], u'Seattle': [u''], u'Ireland': [u''], u'Patrick Madden': [u''], u'Tasha Black': [u''], u'The Narrator': [u'']}
self._aliases after: {u'Tyler Durden': [u''], u'Walter': [u''], u'Dulles': [u''], u'The Paper Street House': [u''], u'Chloe': [u''], u'Albert': [u''], u'Angel Face': [u''], u'Leslie': [u''], u'Robert "Big Bob" Paulson': [u''], u'Madam': [u''], u'Joe': [u''], u'Raymond K. Hessel': [u''], u'Marla Singer': [u''], u'The Support Groups': [u''], u'Parker-Morris Building': [u''], u'Chicago': [u''], u'Project Mayhem': [u''], u'Mrs. Patrick Madden': [u''], u'Seattle': [u''], u'Ireland': [u''], u'Patrick Madden': [u''], u'Tasha Black': [u''], u'The Narrator': [u'']}
BookParser: self._aliases: {u'': u'the narrator'}
Job: 1 Creating X-Ray Files finished
Starting job: Creating X-Ray Files 

    05-17-2016 16:32:15 Fight Club - Chuck Palahniuk 
    05-17-2016 16:32:15     Parsing shelfari data... 
    05-17-2016 16:32:17     Getting format specific data... 
    05-17-2016 16:32:17     Parsing book data... 
    05-17-2016 16:32:24     Creating x-ray... 
    05-17-2016 16:32:28     Sending x-ray to device... 

    X-Ray Creation: 
        Books Completed: 
            Fight Club - Chuck Palahniuk: MOBI 

    X-Ray Sending: 
        Books Failed: 
            Fight Club - Chuck Palahniuk: 
                MOBI: No device is connected. 
Book._parse_shelfari_data:
{1: {'description': 'The protagonist; owner of a money-lending business in London, obsessed with making money.', 'label': 'Ebenezer Scrooge'}, 2: {'description': "Scrooge's former business partner, dec'd.", 'label': 'Jacob Marley'}, 3: {'description': "Scrooge's employee and symbol of simple goodness.  Cratchit comes from a poor family and has a wife with two daugthers and two sons, one of whom is Tiny Tim, a cripple.", 'label': 'Bob Cratchit'}, 4: {'description': 'A spirit.', 'label': 'Ghost of Christmas Past'}, 5: {'description': 'A spirit.', 'label': 'The Ghost of Christmas Present'}, 6: {'description': 'A spirit.', 'label': 'The Ghost of Christmas Yet to Come'}, 7: {'description': 'Wife of Bob Cratchit.', 'label': 'Mrs. Cratchit'}, 8: {'description': 'Youngest son of the Cratchits, a loving, crippled child.', 'label': 'Tiny Tim'}, 9: {'description': 'Oldest child of the Cratchits.', 'label': 'Martha Cratchit'}, 10: {'description': 'Eldest son of the Cratchits.', 'label': 'Peter Cratchit'}, 11: {'description': 'Second daughter of the Cratchits.', 'label': 'Belinda Cratchit'}, 12: {'description': "Scrooge's old boss when he was an apprentice. A very nice, kind, jolly man. Made all his employees joyous.", 'label': 'Mr. Fezziwig'}, 13: {'description': 'Wife of Mr Fezziwig.', 'label': 'Mrs. Fezziwig'}, 14: {'description': "Ebenezer toward the beginning of the story was angry and mean. He had a bad attitude and was very stubborn because he refused to pay for coals to heat his shop and didn't give money to the poor even though he was wealthy. But, towards the end he was different, but you'll have to read to find out because no spoilers.", 'label': 'Ebenezer Scrooge'}, 15: {'description': "Scrooge's fellow apprentice. (In the past)", 'label': 'Dick Wilkins'}, 16: {'description': "Scrooge's nephew.", 'label': 'Fred'}, 17: {'description': "Ghost of Scrooge's partner, who sets Scrooge on the path of righteousness.", 'label': "Jacob Marley's ghost"}, 18: {'description': 'Pawnbroker.', 'label': 'Joe Miller'}, 19: {'description': 'Customer of Scrooge.', 'label': 'Caroline'}, 20: {'description': "The one who had an eye on one of Scrooge's niece's sisters during the Christmas Party.", 'label': 'Topper'}, 21: {'description': "A woman in Scrooge's past.", 'label': 'Belle'}, 22: {'description': "Scrooge's sister; Fred's mother.", 'label': 'Fan'}}
{24: {'description': 'Popular parlor game in which the contestant is blindfolded.  They must then catch another player and guess who he/she had caught. The game dates back to ancient times.', 'label': "Blind man's-buff"}, 25: {'description': 'Used to express disbelief or disgust: nonsense or rubbish.', 'label': 'Humbug'}, 23: {'description': 'Privately funded lodgings for the poor - as opposed to the workhouse, which was publicly funded.', 'label': 'Almshouse'}}
self._aliases before: {u'Ebenezer Scrooge': [u'Ebenezer'], u"Jacob Marley's ghost": [u''], u'Martha Cratchit': [u'Martha'], u'The Ghost of Christmas Yet to Come': [u''], u'Ghost of Christmas Past': [u''], u'Almshouse': [u''], u'Tiny Tim': [u'Tim'], u"Blind man's-buff": [u''], u'Topper': [u''], u'Humbug': [u''], u'Bob Cratchit': [u'Bob', u'Mr. Cratchit'], u'Mrs. Fezziwig': [u''], u'Mrs. Cratchit': [u''], u'Dick Wilkins': [u'Dick', u'Wilkins'], u'Mr. Fezziwig': [u'Fezziwig'], u'Belle': [u''], u'Joe Miller': [u'Joe', u'Miller'], u'The Ghost of Christmas Present': [u''], u'Fred': [u''], u'Jacob Marley': [u'Jacob'], u'Peter Cratchit': [u'Peter'], u'Caroline': [u''], u'Fan': [u''], u'Belinda Cratchit': [u'Belinda']}
self._aliases after: {u'Ebenezer Scrooge': [u'Ebenezer'], u"Jacob Marley's ghost": [u''], u'Martha Cratchit': [u'Martha'], u'The Ghost of Christmas Yet to Come': [u''], u'Ghost of Christmas Past': [u''], u'Almshouse': [u''], u'Tiny Tim': [u'Tim'], u"Blind man's-buff": [u''], u'Topper': [u''], u'Humbug': [u''], u'Bob Cratchit': [u'Bob', u'Mr. Cratchit'], u'Mrs. Fezziwig': [u''], u'Mrs. Cratchit': [u''], u'Dick Wilkins': [u'Dick', u'Wilkins'], u'Mr. Fezziwig': [u'Fezziwig'], u'Belle': [u''], u'Joe Miller': [u'Joe', u'Miller'], u'The Ghost of Christmas Present': [u''], u'Fred': [u''], u'Jacob Marley': [u'Jacob'], u'Peter Cratchit': [u'Peter'], u'Caroline': [u''], u'Fan': [u''], u'Belinda Cratchit': [u'Belinda']}
BookParser: self._aliases: {u'': u'fan', u'fezziwig': u'mr. fezziwig', u'wilkins': u'dick wilkins', u'martha': u'martha cratchit', u'bob': u'bob cratchit', u'dick': u'dick wilkins', u'jacob': u'jacob marley', u'ebenezer': u'ebenezer scrooge', u'joe': u'joe miller', u'tim': u'tiny tim', u'peter': u'peter cratchit', u'miller': u'joe miller', u'belinda': u'belinda cratchit', u'mr. cratchit': u'bob cratchit'}
Job: 3 Creating X-Ray Files finished
Starting job: Creating X-Ray Files 

    05-17-2016 16:39:34 A Christmas Carol - Charles Dickens 
    05-17-2016 16:39:34     Parsing shelfari data... 
    05-17-2016 16:39:40     Getting format specific data... 
    05-17-2016 16:39:40     Parsing book data... 
    05-17-2016 16:39:44     Creating x-ray... 
    05-17-2016 16:39:46     Sending x-ray to device... 

    X-Ray Creation: 
        Books Completed: 
            A Christmas Carol - Charles Dickens: MOBI 

    X-Ray Sending: 
        Books Failed: 
            A Christmas Carol - Charles Dickens: 
                MOBI: No device is connected. 

Book._parse_shelfari_data:
{1: {'description': 'Main character and narrator of story.  Tired of his mundane life, seeking a change and a human connection.', 'label': 'The Narrator'}, 2: {'description': 'Anarchist and primitivist that starts Fight Club and leads the narrator into the darker side of life.', 'label': 'Tyler Durden'}, 3: {'description': "Narrator meets her at support groups. She later becomes Tyler Durden's mistress/girlfriend.", 'label': 'Marla Singer'}, 4: {'description': 'Former bodybuilder who meets the narrator at a support group for Testicular cancer.', 'label': 'Robert "Big Bob" Paulson'}, 5: {'description': "Space monkey. Gets the nickname for having a 'beautiful' face.", 'label': 'Angel Face'}, 6: {'description': 'A girl in the parasite support group that the narrator attends.', 'label': 'Chloe'}, 7: {'description': 'Host of a dinner party where Tyler works as a server.  Married to Madam.', 'label': 'Albert'}, 8: {'description': None, 'label': 'Tasha Black'}, 9: {'description': 'A rich woman throwing a dinner party that Tyler works at as a waiter.', 'label': 'Madam'}, 10: {'description': 'Store employee whose life is undeniably changed by and encounter with Tyler Durden.', 'label': 'Raymond K. Hessel'}, 11: {'description': None, 'label': 'Leslie'}, 12: {'description': None, 'label': 'Mrs. Patrick Madden'}, 13: {'description': None, 'label': 'Joe'}, 14: {'description': None, 'label': 'Patrick Madden'}, 15: {'description': None, 'label': 'Walter'}}
{16: {'description': 'A fictional building in the novel, the "tallest building in the world".', 'label': 'Parker-Morris Building'}, 17: {'description': "The dilapidated house on Paper Street is Tyler Durden's house. The narrator moves into the house after his condo is destroyed by an explosion. The house is practically condemned. The only neighbors are a closed machine shop and a block-long warehouse. A past tenant collected magazines, so there are stacks piled high in the basement and almost every room. The house becomes the headquarters and training ground for Project Mayhem members.", 'label': 'The Paper Street House'}, 18: {'description': 'Noted support groups in the story include Remaining Men Together (the testicular cancer group), Free...', 'label': 'The Support Groups'}, 19: {'description': None, 'label': 'Project Mayhem'}, 20: {'description': None, 'label': 'Ireland'}, 21: {'description': None, 'label': 'Seattle'}, 22: {'description': None, 'label': 'Dulles'}, 23: {'description': None, 'label': 'Chicago'}}
self._aliases before: {u'Walter': [], u'The Narrator': [], u'Dulles': [], u'The Paper Street House': [], u'Chloe': [], u'Albert': [], u'Angel Face': [], u'Leslie': [], u'Robert "Big Bob" Paulson': [], u'Madam': [], u'Joe': [], u'Raymond K. Hessel': [], u'Marla Singer': [], u'The Support Groups': [], u'Parker-Morris Building': [], u'Chicago': [], u'Project Mayhem': [], u'Mrs. Patrick Madden': [], u'Seattle': [], u'Ireland': [], u'Patrick Madden': [], u'Tasha Black': [], u'Tyler Durden': []}
self._aliases after: {u'Walter': [], u'The Narrator': [], u'Dulles': [], u'The Paper Street House': [], u'Chloe': [], u'Albert': [], u'Angel Face': [], u'Leslie': [], u'Robert "Big Bob" Paulson': [], u'Madam': [], u'Joe': [], u'Raymond K. Hessel': [], u'Marla Singer': [], u'The Support Groups': [], u'Parker-Morris Building': [], u'Chicago': [], u'Project Mayhem': [], u'Mrs. Patrick Madden': [], u'Seattle': [], u'Ireland': [], u'Patrick Madden': [], u'Tasha Black': [], u'Tyler Durden': []}
BookParser: self._aliases: {}
Job: 7 Creating X-Ray Files finished
Starting job: Creating X-Ray Files 

    05-17-2016 16:47:52 Fight Club - Chuck Palahniuk 
    05-17-2016 16:47:52     Parsing shelfari data... 
    05-17-2016 16:47:53     Getting format specific data... 
    05-17-2016 16:47:53     Parsing book data... 
    05-17-2016 16:47:57     Creating x-ray... 
    05-17-2016 16:47:57     Sending x-ray to device... 

    X-Ray Creation: 
        Books Completed: 
            Fight Club - Chuck Palahniuk: MOBI 

    X-Ray Sending: 
        Books Failed: 
            Fight Club - Chuck Palahniuk: 
                MOBI: No device is connected. 
sqlite> select id, label, count from entity;
0                                 
1           The Narrat  0         
2           Tyler Durd  0         
3           Marla Sing  0         
4           Robert "Bi  0         
5           Angel Face  0         
6           Chloe       0         
7           Albert      0         
8           Tasha Blac  0         
9           Madam       0         
10          Raymond K.  0         
11          Leslie      0         
12          Mrs. Patri  0         
13          Joe         0         
14          Patrick Ma  0         
15          Walter      0         
16          Parker-Mor  0         
17          The Paper   0         
18          The Suppor  0         
19          Project Ma  0         
20          Ireland     101024    
21          Seattle     0         
22          Dulles      0         
23          Chicago     0         
sqlite> 
sqlite> select id, label, count from entity;
0||
2|Jacob Marley|0
3|Bob Cratchit|0
4|Ghost of Christmas Past|0
5|The Ghost of Christmas Present|0
6|The Ghost of Christmas Yet to Come|0
7|Mrs. Cratchit|0
8|Tiny Tim|0
9|Martha Cratchit|0
10|Peter Cratchit|0
11|Belinda Cratchit|0
12|Mr. Fezziwig|0
13|Mrs. Fezziwig|0
14|Ebenezer Scrooge|0
15|Dick Wilkins|0
16|Fred|0
17|Jacob Marley's ghost|0
18|Joe Miller|0
19|Caroline|0
20|Topper|0
21|Belle|0
22|Fan|65870
23|Almshouse|0
24|Blind man's-buff|0
25|Humbug|0
sqlite> 
sqlite> select id, label, count from entity;
0                                 
1           The Narrat  0         
2           Tyler Durd  52        
3           Marla Sing  13        
4           Robert "Bi  0         
5           Angel Face  2         
6           Chloe       35        
7           Albert      16        
8           Tasha Blac  0         
9           Madam       18        
10          Raymond K.  2         
11          Leslie      7         
12          Mrs. Patri  5         
13          Joe         13        
14          Patrick Ma  6         
15          Walter      8         
16          Parker-Mor  0         
17          The Paper   0         
18          The Suppor  5         
19          Project Ma  58        
20          Ireland     10        
21          Seattle     10        
22          Dulles      5         
23          Chicago     5         
sqlite> 
stoduk commented 8 years ago

With the fix in place, and testing with a new book (so we don't have saved alias data) - see that self._aliases "before" is empty, "after" is not, and yet we aren't ending up with the broken scenario above (we end up with BookParser._aliases = {}, rather than having a "": "some character" entry).

Book._parse_shelfari_data:
{1: {'label': 'Narrator', 'description': 'A witty, satirical voice who is Vonnegut himself.'}, 2: {'label': 'Billy Pilgrim', 'description': 'The main character of the story, a World War II vet who was a POW in the bombing of Dresden. He shifts through time, and at one point was abducted by aliens.'}, 3: {'label': 'Roland Weary', 'description': "Short and stocky antitank gunner during the war and Billy's comrade. He was obsessed with torture devices and gore, in his dying words he blamed Billy for his death."}, 4: {'label': 'Paul Lazzaro', 'description': "A vengeful fellow prisoner-of-war who  blamed Billy for Weary's death who  said he can have anyone killed for a thousand dollars and would have Billy killed."}, 5: {'label': 'Kilgore Trout', 'description': 'Science fiction writer who Billy meets in an alley way.'}, 6: {'label': 'Edgar Derby', 'description': "A prisoner of war with Billy, an older fellow who was a teacher, and wanted to come to war because he couldn't stand seeing all his students go off to war while he wasted away."}, 7: {'label': 'Howard W. Campbell, Jr.', 'description': 'A Nazi who was an American and wrote several training documents to help the Germans better understand their enemy. and tried to end the war.'}, 8: {'label': 'Valencia Merble', 'description': "Billy's wife, a rich fat woman."}, 9: {'label': 'Robert Pilgrim', 'description': "Billy's son who fought in the Green Berets during the Vietnam war."}, 10: {'label': 'Barbara Pilgrim', 'description': "Billy's daughter who thinks her father is crazy and treats him like a child. She is attractive with the exception of her legs which are shaped like those of an Edwardian grand piano."}, 11: {'label': 'Montana Wildhack', 'description': 'Famous movie actress who Billy is put on display with at the zoo on Tralfamadore'}, 12: {'label': 'Eliot Rosewater', 'description': "Billy's friend and fellow patient who introduces him to Kilgore Trout."}, 13: {'label': 'Bertram Copeland Rumfoord', 'description': 'An aging Harvard history professor, retired Air Force brigadier general, and millionaire, who shares a hospital room with Billy and asks Billy to tell him stories about his experience in the Dresden Bombing.'}, 14: {'label': "Mary O'Hare", 'description': "Bernard O'Hare's wife and one of the people to whom the book is dedicated."}, 15: {'label': 'Billy Pilgrim', 'description': 'A man who is symbolic of the absurdities of war. His nonsensical demeanor facilitates his journey through time and space, ultimately articulating an anti-war message.'}, 16: {'label': "Bernard V. O'Hare", 'description': "The narrator's former war comrade."}, 17: {'label': 'Tralfamadorians', 'description': 'Aliens shaped like toilet plungers, each with one hand containing an eye in its palm.'}, 18: {'label': 'Eddie D. Slovik', 'description': 'The only American soldier to be shot for cowardice since the Civil War.'}}
{19: {'label': 'Dresden, Germany', 'description': 'Billy Pilgrim as part of approximately one hundred American prisoners-of-war are transported there to serve as contract laborers. The city was the last city in Germany to be carpet bombed.'}, 20: {'label': 'Tralfamadore', 'description': "Billy Pilgrim was abducted by aliens, taken to the planet Tralfamadore, and displayed naked in a zoo. The Tralfamodorians are shaped similar to toilet plungers. The shaft, which is extremely flexible, is topped by a small hand with one green eye in its palm. This planet's inhabitants see in four dimensions rather than three."}, 21: {'label': 'Ilium, New York', 'description': 'Much of this novel when not set in Dresden is set in Ilium where Billy grew up and established his optometrist office.'}, 22: {'label': 'Slaughterhouse Five', 'description': 'A former slaughterhouse used during World War II in Dresden to house American prisoners-of-war.'}, 23: {'label': 'Salmon Roe', 'description': 'Salmon eggs, better known as red caviar.'}, 24: {'label': 'Thumbscrew', 'description': 'An instrument of torture consisting of a ring into which the thumb is inserted and a screw that is then tightened gradually, until the bones are shattered.'}}
self._aliases before: {}
self._aliases after: {'Tralfamadorians': [], 'Montana Wildhack': [], 'Kilgore Trout': [], 'Edgar Derby': [], 'Howard W. Campbell, Jr.': [], 'Eliot Rosewater': [], "Mary O'Hare": [], 'Robert Pilgrim': [], 'Bertram Copeland Rumfoord': [], 'Billy Pilgrim': [], 'Valencia Merble': [], 'Tralfamadore': [], 'Dresden, Germany': [], 'Slaughterhouse Five': [], 'Narrator': [], 'Paul Lazzaro': [], 'Eddie D. Slovik': [], "Bernard V. O'Hare": [], 'Thumbscrew': [], 'Ilium, New York': [], 'Salmon Roe': [], 'Roland Weary': [], 'Barbara Pilgrim': []}
BookParser: self._aliases: {}
Job: 6 Creating X-Ray Files finished
Starting job: Creating X-Ray Files 

    05-17-2016 16:59:59 Slaughterhouse Five - Kurt Vonnegut 
    05-17-2016 16:59:59     Getting ASIN... 
    05-17-2016 17:00:05     Getting shelfari url... 
    05-17-2016 17:00:41     Parsing shelfari data... 
    05-17-2016 17:00:43     Getting format specific data... 
    05-17-2016 17:00:43     Parsing book data... 
    05-17-2016 17:00:46     Creating x-ray... 
    05-17-2016 17:00:46     Sending x-ray to device... 

    X-Ray Creation: 
        Books Completed: 
            Slaughterhouse Five - Kurt Vonnegut: MOBI 

    X-Ray Sending: 
        Books Failed: 
            Slaughterhouse Five - Kurt Vonnegut: 
                MOBI: No device is connected. 

Book._parse_shelfari_data:
{1: {'label': 'Narrator', 'description': 'A witty, satirical voice who is Vonnegut himself.'}, 2: {'label': 'Billy Pilgrim', 'description': 'The main character of the story, a World War II vet who was a POW in the bombing of Dresden. He shifts through time, and at one point was abducted by aliens.'}, 3: {'label': 'Roland Weary', 'description': "Short and stocky antitank gunner during the war and Billy's comrade. He was obsessed with torture devices and gore, in his dying words he blamed Billy for his death."}, 4: {'label': 'Paul Lazzaro', 'description': "A vengeful fellow prisoner-of-war who  blamed Billy for Weary's death who  said he can have anyone killed for a thousand dollars and would have Billy killed."}, 5: {'label': 'Kilgore Trout', 'description': 'Science fiction writer who Billy meets in an alley way.'}, 6: {'label': 'Edgar Derby', 'description': "A prisoner of war with Billy, an older fellow who was a teacher, and wanted to come to war because he couldn't stand seeing all his students go off to war while he wasted away."}, 7: {'label': 'Howard W. Campbell, Jr.', 'description': 'A Nazi who was an American and wrote several training documents to help the Germans better understand their enemy. and tried to end the war.'}, 8: {'label': 'Valencia Merble', 'description': "Billy's wife, a rich fat woman."}, 9: {'label': 'Robert Pilgrim', 'description': "Billy's son who fought in the Green Berets during the Vietnam war."}, 10: {'label': 'Barbara Pilgrim', 'description': "Billy's daughter who thinks her father is crazy and treats him like a child. She is attractive with the exception of her legs which are shaped like those of an Edwardian grand piano."}, 11: {'label': 'Montana Wildhack', 'description': 'Famous movie actress who Billy is put on display with at the zoo on Tralfamadore'}, 12: {'label': 'Eliot Rosewater', 'description': "Billy's friend and fellow patient who introduces him to Kilgore Trout."}, 13: {'label': 'Bertram Copeland Rumfoord', 'description': 'An aging Harvard history professor, retired Air Force brigadier general, and millionaire, who shares a hospital room with Billy and asks Billy to tell him stories about his experience in the Dresden Bombing.'}, 14: {'label': "Mary O'Hare", 'description': "Bernard O'Hare's wife and one of the people to whom the book is dedicated."}, 15: {'label': 'Billy Pilgrim', 'description': 'A man who is symbolic of the absurdities of war. His nonsensical demeanor facilitates his journey through time and space, ultimately articulating an anti-war message.'}, 16: {'label': "Bernard V. O'Hare", 'description': "The narrator's former war comrade."}, 17: {'label': 'Tralfamadorians', 'description': 'Aliens shaped like toilet plungers, each with one hand containing an eye in its palm.'}, 18: {'label': 'Eddie D. Slovik', 'description': 'The only American soldier to be shot for cowardice since the Civil War.'}}
{19: {'label': 'Dresden, Germany', 'description': 'Billy Pilgrim as part of approximately one hundred American prisoners-of-war are transported there to serve as contract laborers. The city was the last city in Germany to be carpet bombed.'}, 20: {'label': 'Tralfamadore', 'description': "Billy Pilgrim was abducted by aliens, taken to the planet Tralfamadore, and displayed naked in a zoo. The Tralfamodorians are shaped similar to toilet plungers. The shaft, which is extremely flexible, is topped by a small hand with one green eye in its palm. This planet's inhabitants see in four dimensions rather than three."}, 21: {'label': 'Ilium, New York', 'description': 'Much of this novel when not set in Dresden is set in Ilium where Billy grew up and established his optometrist office.'}, 22: {'label': 'Slaughterhouse Five', 'description': 'A former slaughterhouse used during World War II in Dresden to house American prisoners-of-war.'}, 23: {'label': 'Salmon Roe', 'description': 'Salmon eggs, better known as red caviar.'}, 24: {'label': 'Thumbscrew', 'description': 'An instrument of torture consisting of a ring into which the thumb is inserted and a screw that is then tightened gradually, until the bones are shattered.'}}
self._aliases before: {u'Tralfamadorians': [], u'Barbara Pilgrim': [], u'Montana Wildhack': [], u'Kilgore Trout': [], u'Edgar Derby': [], u'Howard W. Campbell, Jr.': [], u'Eliot Rosewater': [], u"Mary O'Hare": [], u'Bertram Copeland Rumfoord': [], u'Billy Pilgrim': [], u'Valencia Merble': [], u'Tralfamadore': [], u'Dresden, Germany': [], u'Slaughterhouse Five': [], u'Narrator': [], u'Paul Lazzaro': [], u'Eddie D. Slovik': [], u"Bernard V. O'Hare": [], u'Thumbscrew': [], u'Ilium, New York': [], u'Salmon Roe': [], u'Roland Weary': [], u'Robert Pilgrim': []}
self._aliases after: {u'Tralfamadorians': [], u'Barbara Pilgrim': [], u'Montana Wildhack': [], u'Kilgore Trout': [], u'Edgar Derby': [], u'Howard W. Campbell, Jr.': [], u'Eliot Rosewater': [], u"Mary O'Hare": [], u'Bertram Copeland Rumfoord': [], u'Billy Pilgrim': [], u'Valencia Merble': [], u'Tralfamadore': [], u'Dresden, Germany': [], u'Slaughterhouse Five': [], u'Narrator': [], u'Paul Lazzaro': [], u'Eddie D. Slovik': [], u"Bernard V. O'Hare": [], u'Thumbscrew': [], u'Ilium, New York': [], u'Salmon Roe': [], u'Roland Weary': [], u'Robert Pilgrim': []}
BookParser: self._aliases: {}
Job: 7 Creating X-Ray Files finished
Starting job: Creating X-Ray Files 

    05-17-2016 17:01:46 Slaughterhouse Five - Kurt Vonnegut 
    05-17-2016 17:01:46     Parsing shelfari data... 
    05-17-2016 17:01:48     Getting format specific data... 
    05-17-2016 17:01:48     Parsing book data... 
    05-17-2016 17:01:51     Creating x-ray... 
    05-17-2016 17:01:51     Sending x-ray to device... 

    X-Ray Creation: 
        Books Completed: 
            Slaughterhouse Five - Kurt Vonnegut: MOBI 

    X-Ray Sending: 
        Books Failed: 
            Slaughterhouse Five - Kurt Vonnegut: 
                MOBI: No device is connected. 

Job: 7 Creating X-Ray Files finished
Starting job: Creating X-Ray Files 

    05-17-2016 17:01:46 Slaughterhouse Five - Kurt Vonnegut 
    05-17-2016 17:01:46     Parsing shelfari data... 
    05-17-2016 17:01:48     Getting format specific data... 
    05-17-2016 17:01:48     Parsing book data... 
    05-17-2016 17:01:51     Creating x-ray... 
    05-17-2016 17:01:51     Sending x-ray to device... 

    X-Ray Creation: 
        Books Completed: 
            Slaughterhouse Five - Kurt Vonnegut: MOBI 

    X-Ray Sending: 
        Books Failed: 
            Slaughterhouse Five - Kurt Vonnegut: 
                MOBI: No device is connected. 
sqlite> select id, label, count from entity;
0                                 
1           Narrator    0         
3           Roland Wea  20        
4           Paul Lazza  10        
5           Kilgore Tr  24        
6           Edgar Derb  24        
7           Howard W.   0         
8           Valencia M  4         
9           Robert Pil  1         
10          Barbara Pi  0         
11          Montana Wi  9         
12          Eliot Rose  4         
13          Bertram Co  2         
14          Mary O'Har  0         
15          Billy Pilg  112       
16          Bernard V.  0         
17          Tralfamado  22        
18          Eddie D. S  1         
19          Dresden, G  1         
20          Tralfamado  36        
21          Ilium, New  3         
22          Slaughterh  0         
23          Salmon Roe  1         
24          Thumbscrew  1         
sqlite> 
stoduk commented 8 years ago

Here is the diff, to make the logs above make some sense:

diff --git a/lib/book.py b/lib/book.py
index 3348ec9..ecb9006 100644
--- a/lib/book.py
+++ b/lib/book.py
@@ -276,15 +276,20 @@ class Book(object):
             self._parsed_shelfari_data = ShelfariParser(self._shelfari_url, spoilers=self._spoilers)
             self._parsed_shelfari_data.parse()

-            for char in self._parsed_shelfari_data.characters.items():
-                if char[1]['label'] not in self._aliases.keys():
-                    self._aliases[char[1]['label']] = ''
+            print("Book._parse_shelfari_data:")
+            print(self._parsed_shelfari_data.characters)
+            print(self._parsed_shelfari_data.terms)
+            print("self._aliases before: %s" % self._aliases)
+            for char in self._parsed_shelfari_data.characters.values():
+                if char['label'] not in self._aliases.keys():
+                    self._aliases[char['label']] = []

-            for term in self._parsed_shelfari_data.terms.items():
-                if term[1]['label'] not in self._aliases.keys():
-                    self._aliases[term[1]['label']] = ''
+            for term in self._parsed_shelfari_data.terms.values():
+                if term['label'] not in self._aliases.keys():
+                    self._aliases[term['label']] = []

             self._prefs['aliases'] = self._aliases
+            print("self._aliases after: %s" % self._aliases)
         except:
             self._status = self.FAIL
             self._status_message = self.FAILED_COULD_NOT_PARSE_SHELFARI_DATA
diff --git a/lib/book_parser.py b/lib/book_parser.py
index fd7f934..b03b34e 100644
--- a/lib/book_parser.py
+++ b/lib/book_parser.py
@@ -42,6 +42,7 @@ class BookParser(object):
             if term.lower() in self.entity_data.keys():
                 for alias in alias_list:
                     self._aliases[alias.lower()] = term.lower()
+        print("BookParser: self._aliases: %s" % self._aliases)            

         words_list = self._aliases.keys() + self.entity_data.keys()
szarroug3 commented 8 years ago

@stoduk Yes, I was thinking about this this morning. Haven't had time to look at it but I'm pretty sure the code is about the same so it should be a very similar fix. I haven't run across this without going into the book config first so I'm confused as to why because it's basically the same thing.