♻️ Restructured sources and managers

This commit is contained in:
GeoffreyCoulaud
2023-05-23 17:00:47 +02:00
parent 95524563bb
commit a11569014d
10 changed files with 17 additions and 24 deletions

View File

@@ -0,0 +1,22 @@
from requests import HTTPError
from src.game import Game
from src.store.managers.manager import Manager
from src.utils.steamgriddb import SGDBAuthError, SGDBError, SGDBHelper
class SGDBManager(Manager):
"""Manager in charge of downloading a game's cover from steamgriddb"""
def run(self, game: Game) -> None:
try:
sgdb = SGDBHelper()
sgdb.conditionaly_update_cover(game)
except SGDBAuthError as error:
# If invalid auth, cancel all SGDBManager tasks
self.cancellable.cancel()
self.report_error(error)
except (HTTPError, SGDBError) as error:
# On other error, just report it
self.report_error(error)
pass