🎨 Made itch cover manager sync
This commit is contained in:
@@ -7,12 +7,12 @@ from urllib3.exceptions import SSLError
|
||||
|
||||
from src import shared
|
||||
from src.game import Game
|
||||
from src.store.managers.async_manager import AsyncManager
|
||||
from src.store.managers.manager import Manager
|
||||
from src.store.managers.local_cover_manager import LocalCoverManager
|
||||
from src.utils.save_cover import resize_cover, save_cover
|
||||
|
||||
|
||||
class ItchCoverManager(AsyncManager):
|
||||
class ItchCoverManager(Manager):
|
||||
"""Manager in charge of downloading the game's cover from itch.io"""
|
||||
|
||||
run_after = set((LocalCoverManager,))
|
||||
@@ -32,17 +32,20 @@ class ItchCoverManager(AsyncManager):
|
||||
cover.raise_for_status()
|
||||
Path(tmp_file.get_path()).write_bytes(cover.content)
|
||||
|
||||
# TODO comment the following blocks of code
|
||||
# Create background blur
|
||||
game_cover = GdkPixbuf.Pixbuf.new_from_stream_at_scale(
|
||||
tmp_file.read(), 2, 2, False
|
||||
).scale_simple(*shared.image_size, GdkPixbuf.InterpType.BILINEAR)
|
||||
|
||||
# Resize square image
|
||||
itch_pixbuf = GdkPixbuf.Pixbuf.new_from_stream(tmp_file.read())
|
||||
itch_pixbuf = itch_pixbuf.scale_simple(
|
||||
shared.image_size[0],
|
||||
itch_pixbuf.get_height() * (shared.image_size[0] / itch_pixbuf.get_width()),
|
||||
GdkPixbuf.InterpType.BILINEAR,
|
||||
)
|
||||
|
||||
# Composite
|
||||
itch_pixbuf.composite(
|
||||
game_cover,
|
||||
0,
|
||||
|
||||
Reference in New Issue
Block a user