♻️ Restructured sources and managers
This commit is contained in:
22
src/store/managers/sgdb_manager.py
Normal file
22
src/store/managers/sgdb_manager.py
Normal 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
|
||||
Reference in New Issue
Block a user