mirror of
https://github.com/ldericher/fftcgtool
synced 2025-01-15 15:02:59 +00:00
Minor Cleanup
This commit is contained in:
parent
b4a690d84e
commit
0379ed074a
2 changed files with 6 additions and 2 deletions
|
@ -19,7 +19,6 @@ class Book:
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
images = ImageLoader.load(cards, resolution, language, num_threads)
|
images = ImageLoader.load(cards, resolution, language, num_threads)
|
||||||
images = [images[card] for card in cards]
|
|
||||||
|
|
||||||
# shorthands
|
# shorthands
|
||||||
# rows and columns per sheet
|
# rows and columns per sheet
|
||||||
|
@ -34,7 +33,7 @@ class Book:
|
||||||
|
|
||||||
for i, image in enumerate(images):
|
for i, image in enumerate(images):
|
||||||
x, y = (i % c) * w, (i // c) * h
|
x, y = (i % c) * w, (i // c) * h
|
||||||
page.paste(image, (x, y, x + w, y + h))
|
page.paste(image, (x, y))
|
||||||
|
|
||||||
self.__pages.append(page)
|
self.__pages.append(page)
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,8 @@ class ImageLoader(threading.Thread):
|
||||||
try:
|
try:
|
||||||
res = requests.get(ImageLoader.__FACE_URL.format(card.code, self.__language))
|
res = requests.get(ImageLoader.__FACE_URL.format(card.code, self.__language))
|
||||||
image = Image.open(io.BytesIO(res.content))
|
image = Image.open(io.BytesIO(res.content))
|
||||||
|
|
||||||
|
# unify images
|
||||||
image.convert("RGB")
|
image.convert("RGB")
|
||||||
image = image.resize(self.__resolution, Image.BICUBIC)
|
image = image.resize(self.__resolution, Image.BICUBIC)
|
||||||
break
|
break
|
||||||
|
@ -65,6 +67,9 @@ class ImageLoader(threading.Thread):
|
||||||
for loader in loaders:
|
for loader in loaders:
|
||||||
images = {**images, **loader.images}
|
images = {**images, **loader.images}
|
||||||
|
|
||||||
|
# sort images to match the initial "cards" list
|
||||||
|
images = [images[card] for card in cards]
|
||||||
|
|
||||||
return images
|
return images
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
|
Loading…
Reference in a new issue