mirror of
https://github.com/titanscouting/tra-superscript.git
synced 2024-12-30 19:39:09 +00:00
added test.py to .gitignore
prepared tra.py for threading implement Signed-off-by: Arthur Lu <learthurgo@gmail.com>
This commit is contained in:
parent
5aae889fd7
commit
7f689389d1
87
tra.py
87
tra.py
@ -27,65 +27,70 @@ def main():
|
|||||||
global pit_enable
|
global pit_enable
|
||||||
|
|
||||||
global config
|
global config
|
||||||
config = su.load_config("config.json")
|
global config = su.load_config("config.json")
|
||||||
|
|
||||||
while(True):
|
task = threading.Thread(name = "match", target = match)
|
||||||
|
task.start()
|
||||||
|
task = threading.Thread(name = "match", target = metric)
|
||||||
|
task.start()
|
||||||
|
task = threading.Thread(name = "pit", target = pit)
|
||||||
|
task.start()
|
||||||
|
|
||||||
if match_enable == True and match == False:
|
def match():
|
||||||
|
|
||||||
def target():
|
match = True
|
||||||
|
|
||||||
apikey = config["key"]["database"]
|
apikey = config["key"]["database"]
|
||||||
competition = config["competition"]
|
competition = config["competition"]
|
||||||
tests = config["statistics"]["match"]
|
tests = config["statistics"]["match"]
|
||||||
|
|
||||||
data = su.load_match(apikey, competition)
|
data = su.load_match(apikey, competition)
|
||||||
su.matchloop(apikey, competition, data, tests)
|
su.matchloop(apikey, competition, data, tests)
|
||||||
|
|
||||||
match = False
|
match = False
|
||||||
return
|
|
||||||
|
|
||||||
match = True
|
if match_enable == True and match == False:
|
||||||
task = threading.Thread(name = "match", target=target)
|
|
||||||
task.start()
|
task = threading.Thread(name = "match", target = match)
|
||||||
|
task.start()
|
||||||
|
|
||||||
if metric_enable == True and metric == False:
|
def metric():
|
||||||
|
|
||||||
def target():
|
|
||||||
|
|
||||||
apikey = config["key"]["database"]
|
metric = True
|
||||||
tbakey = config["key"]["tba"]
|
|
||||||
competition = config["competition"]
|
|
||||||
metric = config["statistics"]["metric"]
|
|
||||||
|
|
||||||
timestamp = su.get_previous_time(apikey)
|
apikey = config["key"]["database"]
|
||||||
|
tbakey = config["key"]["tba"]
|
||||||
|
competition = config["competition"]
|
||||||
|
metric = config["statistics"]["metric"]
|
||||||
|
|
||||||
su.metricloop(tbakey, apikey, competition, timestamp, metric)
|
timestamp = su.get_previous_time(apikey)
|
||||||
|
|
||||||
metric = False
|
su.metricloop(tbakey, apikey, competition, timestamp, metric)
|
||||||
return
|
|
||||||
|
|
||||||
match = True
|
metric = False
|
||||||
task = threading.Thread(name = "metric", target=target)
|
|
||||||
task.start()
|
|
||||||
|
|
||||||
if pit_enable == True and pit == False:
|
if metric_enable == True and metric == False:
|
||||||
|
|
||||||
|
task = threading.Thread(name = "match", target = metric)
|
||||||
|
task.start()
|
||||||
|
|
||||||
def target():
|
def pit():
|
||||||
|
|
||||||
apikey = config["key"]["database"]
|
pit = True
|
||||||
competition = config["competition"]
|
|
||||||
tests = config["statistics"]["pit"]
|
|
||||||
|
|
||||||
data = su.load_pit(apikey, competition)
|
apikey = config["key"]["database"]
|
||||||
su.pitloop(apikey, competition, data, tests)
|
competition = config["competition"]
|
||||||
|
tests = config["statistics"]["pit"]
|
||||||
|
|
||||||
pit = False
|
data = su.load_pit(apikey, competition)
|
||||||
return
|
su.pitloop(apikey, competition, data, tests)
|
||||||
|
|
||||||
|
pit = False
|
||||||
|
|
||||||
|
if pit_enable == True and pit == False:
|
||||||
|
|
||||||
|
task = threading.Thread(name = "pit", target = pit)
|
||||||
|
task.start()
|
||||||
|
|
||||||
pit = True
|
|
||||||
task = threading.Thread(name = "pit", target=target)
|
|
||||||
task.start()
|
|
||||||
|
|
||||||
task = threading.Thread(name = "main", target=main)
|
task = threading.Thread(name = "main", target=main)
|
||||||
task.start()
|
task.start()
|
Loading…
Reference in New Issue
Block a user