From 6ec1d532c7d0d7302c6e964df220e94dfb8c6202 Mon Sep 17 00:00:00 2001 From: Eion Dailey Date: Mon, 24 Jun 2024 10:58:58 -0400 Subject: [PATCH] Fix last sets and other formatting issues --- src/TSHAssetDownloader.py | 6 +- src/TSHThumbnailSettingsWidget.py | 57 ++++++++----------- .../ChallongeDataProvider.py | 3 +- .../StartGGDataProvider.py | 10 ++-- 4 files changed, 30 insertions(+), 46 deletions(-) diff --git a/src/TSHAssetDownloader.py b/src/TSHAssetDownloader.py index 8b650f2f4..11d7cbc88 100644 --- a/src/TSHAssetDownloader.py +++ b/src/TSHAssetDownloader.py @@ -449,10 +449,8 @@ def f(assets): for asset in _assets: filesToDownload = list(asset["files"].values()) for fileToDownload in filesToDownload: - fileToDownload[ - "path"] = f'https://github.com/joaorb64/StreamHelperAssets/releases/latest/download/{fileToDownload["name"]}' - fileToDownload["extractpath"] = f'./user_data/games/{ - game}' + fileToDownload["path"] = f'https://github.com/joaorb64/StreamHelperAssets/releases/latest/download/{fileToDownload["name"]}' + fileToDownload["extractpath"] = f'./user_data/games/{game}' allFilesToDownload.append(filesToDownload) TSHAssetDownloader.instance.downloadDialogue = QProgressDialog( diff --git a/src/TSHThumbnailSettingsWidget.py b/src/TSHThumbnailSettingsWidget.py index cf4c4a185..d1432905b 100644 --- a/src/TSHThumbnailSettingsWidget.py +++ b/src/TSHThumbnailSettingsWidget.py @@ -278,8 +278,7 @@ def __init__(self, *args): self.zoom.valueChanged.connect(lambda: TSHThumbnailSettingsWidget.SaveSettings( self, - key=f"game.{TSHGameAssetManager.instance.selectedGame.get( - 'codename')}.zoom", + key=f"game.{TSHGameAssetManager.instance.selectedGame.get('codename')}.zoom", val=self.zoom.value(), generatePreview=True ) @@ -288,8 +287,7 @@ def __init__(self, *args): self.horizontalAlign.valueChanged.connect(lambda val: [ TSHThumbnailSettingsWidget.SaveSettings( self, - key=f"game.{TSHGameAssetManager.instance.selectedGame.get( - 'codename')}.align.horizontal", + key=f"game.{TSHGameAssetManager.instance.selectedGame.get('codename')}.align.horizontal", val=val, generatePreview=True )] @@ -298,8 +296,7 @@ def __init__(self, *args): self.verticalAlign.valueChanged.connect(lambda val: [ TSHThumbnailSettingsWidget.SaveSettings( self, - key=f"game.{TSHGameAssetManager.instance.selectedGame.get( - 'codename')}.align.vertical", + key=f"game.{TSHGameAssetManager.instance.selectedGame.get('codename')}.align.vertical", val=val, generatePreview=True )] @@ -308,8 +305,7 @@ def __init__(self, *args): self.scaleToFillX.stateChanged.connect(lambda val: [ TSHThumbnailSettingsWidget.SaveSettings( self, - key=f"game.{TSHGameAssetManager.instance.selectedGame.get( - 'codename')}.scaleFillX", + key=f"game.{TSHGameAssetManager.instance.selectedGame.get('codename')}.scaleFillX", val=self.scaleToFillX.isChecked(), generatePreview=True )] @@ -318,8 +314,7 @@ def __init__(self, *args): self.scaleToFillY.stateChanged.connect(lambda val: [ TSHThumbnailSettingsWidget.SaveSettings( self, - key=f"game.{TSHGameAssetManager.instance.selectedGame.get( - 'codename')}.scaleFillY", + key=f"game.{TSHGameAssetManager.instance.selectedGame.get('codename')}.scaleFillY", val=self.scaleToFillY.isChecked(), generatePreview=True )] @@ -328,8 +323,7 @@ def __init__(self, *args): self.proportionalScaling.stateChanged.connect(lambda val: [ TSHThumbnailSettingsWidget.SaveSettings( self, - key=f"game.{TSHGameAssetManager.instance.selectedGame.get( - 'codename')}.proportionalScaling", + key=f"game.{TSHGameAssetManager.instance.selectedGame.get('codename')}.proportionalScaling", val=self.proportionalScaling.isChecked(), generatePreview=True )] @@ -338,38 +332,34 @@ def __init__(self, *args): self.hideSeparators.stateChanged.connect(lambda val: [ TSHThumbnailSettingsWidget.SaveSettings( self, - key=f"game.{TSHGameAssetManager.instance.selectedGame.get( - 'codename')}.hideSeparators", + key=f"game.{TSHGameAssetManager.instance.selectedGame.get('codename')}.hideSeparators", val=self.hideSeparators.isChecked(), generatePreview=True )] ) self.noSeparatorAngle.valueChanged.connect(lambda: - TSHThumbnailSettingsWidget.SaveSettings( - self, - key=f"game.{TSHGameAssetManager.instance.selectedGame.get( - 'codename')}.noSeparatorAngle", - val=self.noSeparatorAngle.value(), - generatePreview=True - ) - ) + TSHThumbnailSettingsWidget.SaveSettings( + self, + key=f"game.{TSHGameAssetManager.instance.selectedGame.get('codename')}.noSeparatorAngle", + val=self.noSeparatorAngle.value(), + generatePreview=True + ) + ) self.noSeparatorDistance.valueChanged.connect(lambda: - TSHThumbnailSettingsWidget.SaveSettings( - self, - key=f"game.{TSHGameAssetManager.instance.selectedGame.get( - 'codename')}.noSeparatorDistance", - val=self.noSeparatorDistance.value(), - generatePreview=True - ) - ) + TSHThumbnailSettingsWidget.SaveSettings( + self, + key=f"game.{TSHGameAssetManager.instance.selectedGame.get('codename')}.noSeparatorDistance", + val=self.noSeparatorDistance.value(), + generatePreview=True + ) + ) self.flipSeparators.stateChanged.connect(lambda val: [ TSHThumbnailSettingsWidget.SaveSettings( self, - key=f"game.{TSHGameAssetManager.instance.selectedGame.get( - 'codename')}.flipSeparators", + key=f"game.{TSHGameAssetManager.instance.selectedGame.get('codename')}.flipSeparators", val=self.flipSeparators.isChecked(), generatePreview=True )] @@ -517,8 +507,7 @@ def __init__(self, *args): self.selectRenderType.currentIndexChanged.connect(lambda: [ SettingsManager.Set( - f"thumbnail_config.game.{ - TSHGameAssetManager.instance.selectedGame.get('codename')}.asset_pack", + f"thumbnail_config.game.{TSHGameAssetManager.instance.selectedGame.get('codename')}.asset_pack", self.selectRenderType.currentData() ), self.updateFromSettings(), diff --git a/src/TournamentDataProvider/ChallongeDataProvider.py b/src/TournamentDataProvider/ChallongeDataProvider.py index 59f6c8e45..f4a14dbfc 100644 --- a/src/TournamentDataProvider/ChallongeDataProvider.py +++ b/src/TournamentDataProvider/ChallongeDataProvider.py @@ -127,8 +127,7 @@ def GetTournamentData(self, progress_callback=None, cancel_event=None): finalData["startAt"] = dateutil.parser.parse( dateElement.get("text"), fuzzy=True).timestamp() except Exception as e: - logger.error(f"Could not get tournament date: { - traceback.format_exc()}") + logger.error(f"Could not get tournament date: {traceback.format_exc()}") participantsElement = next( (d for d in details if d.get("icon") == "fa fa-users"), None) diff --git a/src/TournamentDataProvider/StartGGDataProvider.py b/src/TournamentDataProvider/StartGGDataProvider.py index 2098f7eac..34e903491 100644 --- a/src/TournamentDataProvider/StartGGDataProvider.py +++ b/src/TournamentDataProvider/StartGGDataProvider.py @@ -383,8 +383,7 @@ def _GetMatchTasks(self, setId, progress_callback, cancel_event): return self.ParseMatchDataOldApi({}) data = self.QueryRequests( - f'https://www.start.gg/api/-/gg_api./set/{ - setId};bustCache=true;expand=["setTask"];fetchMostRecentCached=true', + f'https://www.start.gg/api/-/gg_api./set/{setId};bustCache=true;expand=["setTask"];fetchMostRecentCached=true', type=requests.get, params={ "extensions": {"cacheControl": {"version": 1, "noCache": True}}, @@ -1036,8 +1035,7 @@ def ProcessFutureSet(self, _set, eventSlug): if stateCode: stateData = states[stateCode] - path = f'./assets/state_flag/{countryCode}/{ - "_CON" if stateCode == "CON" else stateCode}.png' + path = f'./assets/state_flag/{countryCode}/{"_CON" if stateCode == "CON" else stateCode}.png' if not os.path.exists(path): path = None @@ -1327,11 +1325,11 @@ def GetLastSets(self, playerID, playerNumber, callback, progress_callback, cance "phase_name": phaseName, "round_name": StartGGDataProvider.TranslateRoundName(set.get("fullRoundText")), f"player{players[0]}_score": set.get("entrant1Score"), - f"player{players[0]}_seed": player1Seed.get("seedNum"), + f"player{players[0]}_seed": player1Seed, f"player{players[0]}_team": player1Info.get("prefix"), f"player{players[0]}_name": player1Info.get("gamerTag"), f"player{players[1]}_score": set.get("entrant2Score"), - f"player{players[1]}_seed": player2Seed.get("seedNum"), + f"player{players[1]}_seed": player2Seed, f"player{players[1]}_team": player2Info.get("prefix"), f"player{players[1]}_name": player2Info.get("gamerTag") }