poppu-mtg / StackIt

Python script generating a column-shaped TCG decklist based on cropped captions of each card's art.
MIT License
14 stars 6 forks source link

Pokemon TCGO Decklist does not Generate #43

Closed JeffHoogland closed 7 years ago

JeffHoogland commented 7 years ago

Output in terminal:

jeff@hoogl-desktop:/media/Storage/GitHub/StackIt$ python StackIt.py Rainbow\ Rai .txt ==Settings== cards: {forest: uh, island: uh, mountain: uh, plains: uh, swamp: uh} options: {display_sideboard: true}

Decklist is for Pokemon TCGO ... List(game=2, mainboard=[Card(name='Oranguru ', set='PR-SM', cost=None, quantity= '1', collector_num='SM13'), Card(name='Shaymin-EX ', set='ROS', cost=None, quant ity='1', collector_num='77'), Card(name='Darkrai-EX ', set='BKP', cost=None, qua ntity='2', collector_num='74'), Card(name='Garchomp-EX ', set='PR-XY', cost=None , quantity='1', collector_num='XY167'), Card(name='Giratina-EX ', set='AOR', cos t=None, quantity='1', collector_num='57'), Card(name='Salamence-EX ', set='PR-XY ', cost=None, quantity='1', collector_num='XY170'), Card(name='Solgaleo-GX ', se t='SUM', cost=None, quantity='2', collector_num='89'), Card(name='Cosmog ', set= 'SUM', cost=None, quantity='3', collector_num='64'), Card(name="Trainers' Mail " , set='ROS', cost=None, quantity='4', collector_num='92'), Card(name='Fairy Drop ', set='FAC', cost=None, quantity='2', collector_num='99'), Card(name='Fairy Ga rden ', set='FAC', cost=None, quantity='2', collector_num='100'), Card(name='Oly mpia ', set='GEN', cost=None, quantity='1', collector_num='66'), Card(name='Lysa ndre ', set='AOR', cost=None, quantity='2', collector_num='78'), Card(name='Prof essor Sycamore ', set='BKP', cost=None, quantity='4', collector_num='107'), Card (name='Nest Ball ', set='SUM', cost=None, quantity='2', collector_num='123'), Ca rd(name='Special Charge ', set='STS', cost=None, quantity='1', collector_num='10 5'), Card(name='Skyla ', set='BKT', cost=None, quantity='1', collector_num='148' ), Card(name='Fighting Fury Belt ', set='BKP', cost=None, quantity='2', collector_num='99'), Card(name='N ', set='FAC', cost=None, quantity='2', collector_num='105'), Card(name='Rare Candy ', set='PLB', cost=None, quantity='3', collector_num='85'), Card(name='Ultra Ball ', set='FAC', cost=None, quantity='4', collector_num='113'), Card(name='VS Seeker ', set='PHF', cost=None, quantity='4', collector_num='109'), Card(name='Double Dragon Energy ', set='ROS', cost=None, quantity='4', collector_num='97'), Card(name='Rainbow Energy ', set='XY', cost=None, quantity='4', collector_num='131'), Card(name='Darkness Energy ', set='Energy', cost=None, quantity='6', collector_num='7')], sideboard=[], commander=[]) https://s3.amazonaws.com/pokegoldfish/images/gf/Oranguru-PR-SM-SM13.jpg Downloading https://s3.amazonaws.com/pokegoldfish/images/gf/Oranguru-PR-SM-SM13.jpg Traceback (most recent call last): File "StackIt.py", line 394, in main(sys.argv[1]) File "StackIt.py", line 315, in main cut = cut.resize((deckwidth,34)) File "/usr/lib/python2.7/dist-packages/PIL/Image.py", line 1526, in resize self.load() File "/usr/lib/python2.7/dist-packages/PIL/Image.py", line 1961, in load self.im = self.im.crop(self.__crop) TypeError: integer argument expected, got float

Decklist file contents: http://paste.debian.net/929788/

Also worth noting that on my default deck export from PTCGO my card names have a prefix in front of them of *

For example:

Had to remove the * at the start before it would try to generate anything at all.

silasary commented 7 years ago

Adding support for * is simple,

The bigger issue, I'll poke at now.

silasary commented 7 years ago

Huh, turns out that that list crashes well before that point if I use python3, and works fine for me with python2. I'll do more digging.

JeffHoogland commented 7 years ago

Here is a decklist exported straight from PTCGO for reference: http://paste.debian.net/929792/

silasary commented 7 years ago

Thanks. Is there any reason there's a 『 㻿 』 at the end of the file?

JeffHoogland commented 7 years ago

No idea. Just there when I click the export list from PTCGO and paste it into my text editor.

silasary commented 7 years ago

Weird. Not an issue, and that line is ignored anyway. But certainly an oddity.

silasary commented 7 years ago

Well, I've discovered that a Byte Order Marker wrecks everything (#45), added support for asterisks, and made it work on Python 3.

But no luck reproducing your bug?

silasary commented 7 years ago

I should probably ask: What version of pillow are you using? Maybe it's a problem with outdated libraries?

JeffHoogland commented 7 years ago

I am using the default python-pil version in Ubuntu 16.04 which appears to be 3.1.2

silasary commented 7 years ago

I'd recommend updating to Pillow 4.1 (You'll need to uninstall the distro-provided PIL first).

JeffHoogland commented 7 years ago

Ahh, have other packages that depend on that one installed so can't remove it nicely. Will just do without - thanks for taking the time to look into it.

silasary commented 7 years ago

It should be 100% backwards compatible.

JeffHoogland commented 7 years ago

It might be, but I need a debian package that is compatible with Ubuntu 16.04 to not create a dependency mess inside of apt. Looked around and doesn't seem to exist currently.

silasary commented 7 years ago

(And at this stage, I'm not even sure it's the cause of the issue. I haven't done any tests with PIL to verify whether it actually is the cause)

silasary commented 7 years ago

Ah, right. Apt dependencies :/ Let me do more digging.

silasary commented 7 years ago

Alternatively, if you install pillow in python3, and use python3 to run StackIt, it won't have any conflicts.

JeffHoogland commented 7 years ago

Fought with apt a small bit and got pillow4, works as expected. Thanks.

silasary commented 7 years ago

Good to hear :)