Files
cartridges/src/store/managers/sgdb_manager.py
GeoffreyCoulaud 695cc88d76 🎨 Made OnlineCoverManager more general
- Does compositing of image with a blurred background
- Stretches the original image if it's not too much
- Handles images that are too wide and images that are too tall
- Removed ItchCoverManager
2023-06-14 00:05:38 +02:00

27 lines
1009 B
Python

from json import JSONDecodeError
from requests.exceptions import HTTPError, SSLError
from src.game import Game
from src.store.managers.async_manager import AsyncManager
from src.store.managers.online_cover_manager import OnlineCoverManager
from src.store.managers.local_cover_manager import LocalCoverManager
from src.store.managers.steam_api_manager import SteamAPIManager
from src.utils.steamgriddb import SGDBAuthError, SGDBHelper
class SGDBManager(AsyncManager):
"""Manager in charge of downloading a game's cover from steamgriddb"""
run_after = (SteamAPIManager, LocalCoverManager, OnlineCoverManager)
retryable_on = (HTTPError, SSLError, ConnectionError, JSONDecodeError)
def manager_logic(self, game: Game, _additional_data: dict) -> None:
try:
sgdb = SGDBHelper()
sgdb.conditionaly_update_cover(game)
except SGDBAuthError:
# If invalid auth, cancel all SGDBManager tasks
self.cancellable.cancel()
raise