Skip to content

Commit

Permalink
Merge pull request #778 from ZombieHDGaming/bugfix/line-endings
Browse files Browse the repository at this point in the history
How many times do we have to teach you this less old man?!
  • Loading branch information
ZombieHDGaming authored Oct 30, 2024
2 parents b7bba19 + 83f103e commit 748cb2c
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 28 deletions.
6 changes: 2 additions & 4 deletions src/Helpers/TSHCountryHelper.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,7 @@ def FindState(countryCode, city):
None
)
if state is not None:
logger.debug(f"State was explicit: [{
city}] -> [{part}] = {state}")
logger.debug(f"State was explicit: [{city}] -> [{part}] = {state}")
return state["original_code"]

# No, so get by City
Expand All @@ -239,8 +238,7 @@ def FindState(countryCode, city):
TSHCountryHelper.remove_accents_lower(part), None)

if state is not None:
logger.debug(f"Got state from city name: [{
city}] -> [{part}] = {state}")
logger.debug(f"Got state from city name: [{city}] -> [{part}] = {state}")
return state

return None
Expand Down
9 changes: 3 additions & 6 deletions src/TSHGameAssetManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -939,19 +939,16 @@ def GetCharacterAssets(self, characterCodename: str, skin: int, assetpack: str =
else:
metadata_title_locale = asset.get("metadata", {})[
key].get("title", '')
charFiles[assetKey]['metadata'][f"{
key}"]["title"] = metadata_title_locale
charFiles[assetKey]['metadata'][f"{
key}"][f"value_en"] = metadata[key]
charFiles[assetKey]['metadata'][f"{key}"]["title"] = metadata_title_locale
charFiles[assetKey]['metadata'][f"{key}"][f"value_en"] = metadata[key]
if TSHLocaleHelper.exportLocale in asset.get("metadata", {})[key]["values"].get(characterCodename, {}).get("locale", {}).keys() or TSHLocaleHelper.exportLocale.split('-')[0] in asset.get("metadata", {})[key]["values"].get(characterCodename, {}).get("locale", {}).keys():
try:
metadata[key] = asset.get("metadata", {})[key]["values"].get(
characterCodename, {}).get("locale", {})[TSHLocaleHelper.exportLocale]
except KeyError:
metadata[key] = asset.get("metadata", {})[key]["values"].get(
characterCodename, {}).get("locale", {})[TSHLocaleHelper.exportLocale.split('-')[0]]
charFiles[assetKey]['metadata'][f"{
key}"][f"value"] = metadata[key]
charFiles[assetKey]['metadata'][f"{key}"][f"value"] = metadata[key]

# if len(metadata.keys()) > 0:
# if str(skin) in metadata:
Expand Down
3 changes: 1 addition & 2 deletions src/TSHScoreboardPlayerWidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -530,8 +530,7 @@ def LoadStates(self, index):
item = QStandardItem()
# Windows has some weird thing with files named CON.png. In case a state code is CON,
# we try to load _CON.png instead
path = f'./assets/state_flag/{countryData.get(
"code")}/{"_CON" if state_code == "CON" else state_code}.png'
path = f'./assets/state_flag/{countryData.get("code")}/{"_CON" if state_code == "CON" else state_code}.png'

if not os.path.exists(path):
path = None
Expand Down
6 changes: 2 additions & 4 deletions src/TSHScoreboardWidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -563,8 +563,7 @@ def SetPlayersPerTeam(self, number):
p = TSHScoreboardPlayerWidget(
index=len(self.team1playerWidgets)+1,
teamNumber=1,
path=f'score.{self.scoreboardNumber}.team.{
1}.player.{len(self.team1playerWidgets)+1}',
path=f'score.{self.scoreboardNumber}.team.{1}.player.{len(self.team1playerWidgets)+1}',
scoreboardNumber=self.scoreboardNumber)
self.playerWidgets.append(p)

Expand Down Expand Up @@ -593,8 +592,7 @@ def SetPlayersPerTeam(self, number):
p = TSHScoreboardPlayerWidget(
index=len(self.team2playerWidgets)+1,
teamNumber=2,
path=f'score.{self.scoreboardNumber}.team.{
2}.player.{len(self.team2playerWidgets)+1}',
path=f'score.{self.scoreboardNumber}.team.{2}.player.{len(self.team2playerWidgets)+1}',
scoreboardNumber=self.scoreboardNumber)
self.playerWidgets.append(p)

Expand Down
9 changes: 3 additions & 6 deletions src/TournamentDataProvider/ChallongeDataProvider.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,7 @@ def GetTournamentData(self, progress_callback=None, cancel_event=None):
slug = self.GetSlug()

data = self.scraper.get(
f"https://challonge.com/en/search/tournaments.json?filters%5B&page=1&per=1&q={
slug}",
f"https://challonge.com/en/search/tournaments.json?filters%5B&page=1&per=1&q={slug}",

)
logger.debug(data.text)
Expand All @@ -134,8 +133,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 All @@ -157,8 +155,7 @@ def GetIconURL(self):
slug = self.GetSlug()

data = self.scraper.get(
f"https://challonge.com/en/search/tournaments.json?filters%5B&page=1&per=1&q={
slug}",
f"https://challonge.com/en/search/tournaments.json?filters%5B&page=1&per=1&q={slug}",
headers=HEADERS
)

Expand Down
6 changes: 2 additions & 4 deletions src/TournamentDataProvider/StartGGDataProvider.py
Original file line number Diff line number Diff line change
Expand Up @@ -392,8 +392,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 @@ -1054,8 +1053,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
3 changes: 1 addition & 2 deletions src/TournamentStreamHelper.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,7 @@ def ExtractUpdate():
tar.extract(m)
updateLog.append(f"Extract {m}")
except Exception:
updateLog.append(f"Failed to extract {
m} - {traceback.format_exc()}")
updateLog.append(f"Failed to extract {m} - {traceback.format_exc()}")

try:
with open("assets/update_log.txt", "w") as f:
Expand Down

0 comments on commit 748cb2c

Please sign in to comment.