|
5 | 5 | import os
|
6 | 6 | import requests
|
7 | 7 | import re
|
| 8 | +import time |
8 | 9 |
|
9 | 10 | font = ('Roboto', 14)
|
10 | 11 | team_image = sg.Image(filename='domlogo-files/photos/idle.png')
|
|
41 | 42 | api_url = f'{api_url}/contests/{cid}'
|
42 | 43 | print(f'Contest is {cid}.')
|
43 | 44 |
|
44 |
| -latest_logfile = max(glob.glob('output/log/judge.*-0.log'), key=os.path.getctime) |
| 45 | +latest_logfile = max(glob.glob('output/log/judge.*-2.log'), key=os.path.getctime) |
45 | 46 | print(f'Checking logfile {latest_logfile}')
|
46 | 47 | with open(latest_logfile, 'r') as logfile:
|
47 | 48 | # Seeks to the end of the file.
|
48 | 49 | logfile.seek(0, 2)
|
49 | 50 | results = []
|
50 | 51 | last_seen, needs_update = (None, None)
|
51 | 52 | while True:
|
52 |
| - event, values = window.read(timeout=10) |
| 53 | + event, values = window.read(timeout=30) |
53 | 54 | if event == sg.WIN_CLOSED:
|
54 | 55 | break
|
55 | 56 | line = logfile.readline()
|
| 57 | + # Sleep here for a tiny amount of time to avoid using too much CPU. |
| 58 | + if len(line) == 0: |
| 59 | + time.sleep(0.01) |
56 | 60 | if 'Working directory:' in line:
|
57 | 61 | token = line.strip().split('/')
|
58 | 62 | judging_id = token[-1]
|
|
65 | 69 | team_id = submission_data['team_id']
|
66 | 70 | last_seen = (submission_id, judging_id, team_id)
|
67 | 71 | new_filename = f'domlogo-files/photos/{team_id}.png'
|
68 |
| - if team_id>=120: |
69 |
| - team_image.update(filename=new_filename) |
70 |
| - f'domlogo-files/photos/{team_id}.png') |
71 |
| - team_image.update(filename=f'domlogo-files/photos/{team_id}.png') |
| 72 | + if (int)(team_id) >= 120: |
| 73 | + new_filename = f'domlogo-files/photos/crew.png' |
| 74 | + team_image.update(filename=new_filename) |
72 | 75 | metadata_text.update(f's{submission_id} / {submission_data["problem_id"]} / {submission_data["language_id"]}')
|
73 | 76 | results_text.update('Busy compiling.')
|
74 | 77 | elif 'No submissions in queue' in line:
|
|
96 | 99 | color = 'DeepSkyBlue'
|
97 | 100 | for i in range(len(cache)-1):
|
98 | 101 | cache[i] = cache[i+1]
|
| 102 | + if (int)(tid) >= 120: |
| 103 | + tid = 'DOMjudge' |
99 | 104 | cache[-1] = (f'domlogo-files/logos/{tid}.png', f's{sid}/j{jid}\n{verdict}', color, jid)
|
100 | 105 | for i in range(len(cache)):
|
101 | 106 | previous_column[i][0].update(filename=cache[i][0])
|
|
0 commit comments