mirror of
https://github.com/ldericher/fftcgtool
synced 2025-01-15 15:02:59 +00:00
minor bug fixes
This commit is contained in:
parent
77c0e9d3fb
commit
52216406a6
4 changed files with 13 additions and 6 deletions
|
@ -18,4 +18,4 @@ WORKDIR "/app"
|
||||||
|
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
CMD ["./main.py"]
|
ENTRYPOINT ["./main.py"]
|
||||||
|
|
6
card.py
6
card.py
|
@ -66,7 +66,11 @@ class Card:
|
||||||
|
|
||||||
# download and resize card image
|
# download and resize card image
|
||||||
def get_image(self, resolution):
|
def get_image(self, resolution):
|
||||||
response = requests.get(self._iurl)
|
try:
|
||||||
|
response = requests.get(self._iurl)
|
||||||
|
except:
|
||||||
|
return False
|
||||||
|
|
||||||
im = Image.open(BytesIO(response.content))
|
im = Image.open(BytesIO(response.content))
|
||||||
im = im.convert("RGB")
|
im = im.convert("RGB")
|
||||||
im = im.resize(resolution, Image.BICUBIC)
|
im = im.resize(resolution, Image.BICUBIC)
|
||||||
|
|
2
main.py
2
main.py
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import json
|
import json
|
||||||
|
|
9
opus.py
9
opus.py
|
@ -27,9 +27,12 @@ class imageLoader(threading.Thread):
|
||||||
# take next card
|
# take next card
|
||||||
i, card = self.__queue.get()
|
i, card = self.__queue.get()
|
||||||
|
|
||||||
# fetch card image
|
# fetch card image (retry on fail)
|
||||||
logger.info("get image for card {}".format(card))
|
while True:
|
||||||
im = card.get_image(self.__resolution)
|
logger.info("get image for card {}".format(card))
|
||||||
|
im = card.get_image(self.__resolution)
|
||||||
|
if im:
|
||||||
|
break
|
||||||
|
|
||||||
# paste image in correct position
|
# paste image in correct position
|
||||||
self.__lock.acquire()
|
self.__lock.acquire()
|
||||||
|
|
Loading…
Reference in a new issue