Skip to content

Commit

Permalink
Merge pull request #675 from joaorb64/feature/export_set_autoupdate_data
Browse files Browse the repository at this point in the history
Export set autoupdate data
  • Loading branch information
joaorb64 authored Dec 15, 2023
2 parents 69f626e + 5ce048d commit ce724b9
Show file tree
Hide file tree
Showing 11 changed files with 302 additions and 268 deletions.
Binary file modified TSH.exe
Binary file not shown.
48 changes: 41 additions & 7 deletions src/TSHScoreboardWidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,8 @@ def __init__(self, scoreboardNumber=1, *args):
self.timerCancelBt = QPushButton()
self.timerCancelBt.setIcon(QIcon('assets/icons/cancel.svg'))
self.timerCancelBt.setIconSize(QSize(12, 12))
self.timerCancelBt.clicked.connect(self.StopAutoUpdate)
self.timerCancelBt.clicked.connect(
lambda: self.StopAutoUpdate(clear_variables=True))
self.timerLayout.layout().addWidget(self.timerCancelBt)
self.timerLayout.setVisible(False)

Expand Down Expand Up @@ -697,9 +698,31 @@ def NewSetSelected(self, data):
TSHTournamentDataProvider.instance.GetStreamQueue()

if data.get("id") != None and data.get("id") != self.lastSetSelected:
# A new set was loaded
self.lastSetSelected = data.get("id")

# Clear stage strike data
StateManager.Unset(
f'score.{self.scoreboardNumber}.stage_strike')
self.lastSetSelected = data.get("id")

# Add general set data to object: id, auto update type, station/stream identifier, etc
StateManager.Set(
f'score.{self.scoreboardNumber}.set_id', data.get("id"))

StateManager.Set(
f'score.{self.scoreboardNumber}.auto_update', data.get("auto_update"))

if self.lastStationSelected:
StateManager.Set(
f'score.{self.scoreboardNumber}.station', self.lastStationSelected.get('identifier'))
else:
StateManager.Set(
f'score.{self.scoreboardNumber}.station', None)

# Clear previous scores
# Important because when we receive scores as 0 we don't update based on that
# Otherwise an offline set which is only updated after it's complete would reset the score
# all the time since it would be 0-0 until then
self.CommandClearAll()
self.ClearScore()

Expand Down Expand Up @@ -731,13 +754,23 @@ def NewSetSelected(self, data):
p.dataLock.release()
StateManager.ReleaseSaving()

def StopAutoUpdate(self):
def StopAutoUpdate(self, clear_variables=False):
if self.autoUpdateTimer != None:
self.autoUpdateTimer.stop()
self.autoUpdateTimer = None
if self.timeLeftTimer != None:
self.timeLeftTimer.stop()
self.timeLeftTimer = None

if clear_variables:
self.lastSetSelected = None
self.lastStationSelected = None

StateManager.Set(
f'score.{self.scoreboardNumber}.auto_update', None)
StateManager.Set(f'score.{self.scoreboardNumber}.set_id', None)
StateManager.Set(f'score.{self.scoreboardNumber}.station', None)

self.timerLayout.setVisible(False)

def UpdateTimeLeftTimer(self):
Expand Down Expand Up @@ -949,10 +982,11 @@ def UpdateSetData(self, data):
# Avoid loading data from the previous set
if str(data.get("id")) != str(self.lastSetSelected):
return

if SettingsManager.Get("general.disable_overwrite", False):
for entrant in data.get("entrants"):
if(entrant[0].get("gamerTag") in TSHPlayerDB.database):
entrant[0] = entrant[0] | TSHPlayerDB.database[entrant[0].get("gamerTag")]

if (entrant[0].get("gamerTag") in TSHPlayerDB.database):
entrant[0] = entrant[0] | TSHPlayerDB.database[entrant[0].get(
"gamerTag")]

self.ChangeSetData(data)
58 changes: 29 additions & 29 deletions src/i18n/TSH_de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,11 @@ p, li { white-space: pre-wrap; }
<context>
<name>Form</name>
<message>
<location filename="../layout/TSHScoreboardScore.ui" line="21"/>
<location filename="../layout/TSHScoreboardTeam.ui" line="20"/>
<location filename="../layout/TSHScoreboardPlayer.ui" line="25"/>
<location filename="../layout/TSHScoreboardScore.ui" line="21"/>
<location filename="../layout/TSHScoreboardStage.ui" line="14"/>
<location filename="../layout/TSHThumbnailSettings.ui" line="14"/>
<location filename="../layout/TSHScoreboardPlayer.ui" line="25"/>
<source>Form</source>
<translation></translation>
</message>
Expand Down Expand Up @@ -622,14 +622,14 @@ p, li { white-space: pre-wrap; }
<context>
<name>GroupBox</name>
<message>
<location filename="../layout/TSHCommentary.ui" line="23"/>
<location filename="../layout/TSHCommentator.ui" line="29"/>
<location filename="../layout/TSHCommentary.ui" line="23"/>
<source>GroupBox</source>
<translation></translation>
</message>
<message>
<location filename="../layout/TSHCommentary.ui" line="26"/>
<location filename="../layout/TSHCommentator.ui" line="32"/>
<location filename="../layout/TSHCommentary.ui" line="26"/>
<source>Commentator 1</source>
<translation>Kommentator 1</translation>
</message>
Expand All @@ -644,38 +644,38 @@ p, li { white-space: pre-wrap; }
<translation></translation>
</message>
<message>
<location filename="../layout/TSHCommentary.ui" line="90"/>
<location filename="../layout/TSHCommentator.ui" line="90"/>
<location filename="../layout/TSHCommentary.ui" line="90"/>
<source>GamerTag</source>
<translation>Spielername</translation>
</message>
<message>
<location filename="../layout/TSHCommentary.ui" line="108"/>
<location filename="../layout/TSHCommentator.ui" line="108"/>
<location filename="../layout/TSHCommentary.ui" line="108"/>
<source>REAL NAME</source>
<translation>KLARNAME</translation>
</message>
<message>
<location filename="../layout/TSHCommentary.ui" line="124"/>
<location filename="../layout/TSHCommentator.ui" line="124"/>
<location filename="../layout/TSHCommentary.ui" line="124"/>
<source>Real Name</source>
<translation>Klarname</translation>
</message>
<message>
<location filename="../layout/TSHCommentary.ui" line="140"/>
<location filename="../layout/TSHCommentator.ui" line="140"/>
<location filename="../layout/TSHCommentary.ui" line="140"/>
<source>TWITTER</source>
<translation></translation>
</message>
<message>
<location filename="../layout/TSHCommentary.ui" line="156"/>
<location filename="../layout/TSHCommentator.ui" line="156"/>
<location filename="../layout/TSHCommentary.ui" line="156"/>
<source>Handle Only</source>
<translation>Handle exkl. @</translation>
</message>
<message>
<location filename="../layout/TSHCommentary.ui" line="170"/>
<location filename="../layout/TSHCommentator.ui" line="172"/>
<location filename="../layout/TSHCommentary.ui" line="170"/>
<source>PRONOUNS</source>
<translation>PRONOMEN</translation>
</message>
Expand Down Expand Up @@ -740,22 +740,22 @@ p, li { white-space: pre-wrap; }
<translation>Spielerliste</translation>
</message>
<message>
<location filename="../TSHBracketWidget.py" line="72"/>
<location filename="../TSHPlayerListWidget.py" line="56"/>
<location filename="../TSHBracketWidget.py" line="72"/>
<source>Number of slots</source>
<translation>Zahl der Slots</translation>
</message>
<message>
<location filename="../TSHBracketWidget.py" line="83"/>
<location filename="../TSHPlayerListWidget.py" line="65"/>
<location filename="../TSHBracketWidget.py" line="83"/>
<source>Players per slot</source>
<translation>Spieler pro Slot</translation>
</message>
<message>
<location filename="../TSHPlayerListWidget.py" line="74"/>
<location filename="../TSHBracketWidget.py" line="92"/>
<location filename="../TSHScoreboardWidget.py" line="120"/>
<location filename="../TSHCommentaryWidget.py" line="47"/>
<location filename="../TSHBracketWidget.py" line="92"/>
<location filename="../TSHPlayerListWidget.py" line="74"/>
<source>Characters per player</source>
<translation>Charaktere pro Slot</translation>
</message>
Expand Down Expand Up @@ -805,8 +805,8 @@ p, li { white-space: pre-wrap; }
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../TournamentStreamHelper.py" line="828"/>
<location filename="../TSHScoreboardStageWidget.py" line="237"/>
<location filename="../TournamentStreamHelper.py" line="828"/>
<source>Update</source>
<translation></translation>
</message>
Expand Down Expand Up @@ -878,8 +878,8 @@ p, li { white-space: pre-wrap; }
<translation>Auf Updates prüfen</translation>
</message>
<message>
<location filename="../TournamentStreamHelper.py" line="441"/>
<location filename="../TSHAssetDownloader.py" line="78"/>
<location filename="../TournamentStreamHelper.py" line="441"/>
<source>Download assets</source>
<translation>Assets herunterladen</translation>
</message>
Expand Down Expand Up @@ -1073,10 +1073,10 @@ p, li { white-space: pre-wrap; }
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../TournamentStreamHelper.py" line="831"/>
<location filename="../TournamentStreamHelper.py" line="841"/>
<location filename="../TSHAssetDownloader.py" line="305"/>
<location filename="../TSHAssetDownloader.py" line="458"/>
<location filename="../TournamentStreamHelper.py" line="831"/>
<location filename="../TournamentStreamHelper.py" line="841"/>
<source>Cancel</source>
<translation>Abbrechen</translation>
</message>
Expand Down Expand Up @@ -1258,8 +1258,8 @@ p, li { white-space: pre-wrap; }
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../TSHSelectStationWindow.py" line="85"/>
<location filename="../TSHSelectSetWindow.py" line="95"/>
<location filename="../TSHSelectStationWindow.py" line="85"/>
<source>Stream</source>
<translation></translation>
</message>
Expand Down Expand Up @@ -1363,7 +1363,7 @@ p, li { white-space: pre-wrap; }
</message>
<message>
<location filename="../TSHScoreboardWidget.py" line="204"/>
<location filename="../TSHScoreboardWidget.py" line="503"/>
<location filename="../TSHScoreboardWidget.py" line="504"/>
<source>Load set</source>
<translation>Set laden</translation>
</message>
Expand All @@ -1372,8 +1372,8 @@ p, li { white-space: pre-wrap; }
<translation>aktuelles Stream-Set laden</translation>
</message>
<message>
<location filename="../TSHScoreboardWidget.py" line="273"/>
<location filename="../TSHScoreboardWidget.py" line="313"/>
<location filename="../TSHScoreboardWidget.py" line="274"/>
<location filename="../TSHScoreboardWidget.py" line="314"/>
<source>TEAM {0}</source>
<translation>TEAM {0}</translation>
</message>
Expand All @@ -1382,8 +1382,8 @@ p, li { white-space: pre-wrap; }
<location filename="../TournamentStreamHelper.py" line="160"/>
<location filename="../TournamentStreamHelper.py" line="570"/>
<location filename="../TournamentStreamHelper.py" line="794"/>
<location filename="../TSHScoreboardWidget.py" line="484"/>
<location filename="../TSHThumbnailSettingsWidget.py" line="930"/>
<location filename="../TSHScoreboardWidget.py" line="485"/>
<source>Warning</source>
<translation>ACHTUNG</translation>
</message>
Expand All @@ -1393,17 +1393,17 @@ p, li { white-space: pre-wrap; }
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../TSHScoreboardWidget.py" line="497"/>
<location filename="../TSHScoreboardWidget.py" line="498"/>
<source>Load set from {0}</source>
<translation>Set von {0} laden</translation>
</message>
<message>
<location filename="../TSHScoreboardWidget.py" line="767"/>
<location filename="../TSHScoreboardWidget.py" line="800"/>
<source>Load user set ({0})</source>
<translation>User-Set {0} laden</translation>
</message>
<message>
<location filename="../TSHScoreboardWidget.py" line="771"/>
<location filename="../TSHScoreboardWidget.py" line="804"/>
<source>Load user set</source>
<translation>User-Set laden</translation>
</message>
Expand Down Expand Up @@ -1638,18 +1638,18 @@ p, li { white-space: pre-wrap; }
<context>
<name>thumb_app</name>
<message>
<location filename="../TSHScoreboardWidget.py" line="458"/>
<location filename="../TSHThumbnailSettingsWidget.py" line="928"/>
<location filename="../TSHScoreboardWidget.py" line="459"/>
<source>TSH - Thumbnail</source>
<translation></translation>
</message>
<message>
<location filename="../TSHScoreboardWidget.py" line="463"/>
<location filename="../TSHScoreboardWidget.py" line="464"/>
<source>The thumbnail has been generated here:</source>
<translation>Thumbnail wurde erstellt:</translation>
</message>
<message>
<location filename="../TSHScoreboardWidget.py" line="464"/>
<location filename="../TSHScoreboardWidget.py" line="465"/>
<source>The video title and description have also been generated.</source>
<translation type="unfinished"></translation>
</message>
Expand Down
Loading

0 comments on commit ce724b9

Please sign in to comment.