Skip to content

Commit

Permalink
Merge pull request #740 from ZombieHDGaming/bugfix/last-sets
Browse files Browse the repository at this point in the history
Fix last sets and other formatting issues
  • Loading branch information
ZombieHDGaming authored Jun 24, 2024
2 parents 0e95812 + 6ec1d53 commit c2e214a
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 46 deletions.
6 changes: 2 additions & 4 deletions src/TSHAssetDownloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
57 changes: 23 additions & 34 deletions src/TSHThumbnailSettingsWidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand All @@ -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
)]
Expand All @@ -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
)]
Expand All @@ -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
)]
Expand All @@ -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
)]
Expand All @@ -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
)]
Expand All @@ -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
)]
Expand Down Expand Up @@ -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(),
Expand Down
3 changes: 1 addition & 2 deletions src/TournamentDataProvider/ChallongeDataProvider.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
10 changes: 4 additions & 6 deletions src/TournamentDataProvider/StartGGDataProvider.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}},
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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")
}
Expand Down

0 comments on commit c2e214a

Please sign in to comment.