fix input of scorometer

This commit is contained in:
GitBluub
2022-12-21 18:33:17 +09:00
parent 1356569fdb
commit 4e73f25238
+3 -2
View File
@@ -69,13 +69,13 @@ class Scorometer():
def gameLoop(self): def gameLoop(self):
while True: while True:
if select.select([sys.stdin, ], [], [], 0.0)[0]: if select.select([sys.stdin, ], [], [], 0.0)[0]:
line = sys.stdin.readline() line = input()
if not line: if not line:
break break
print("handling message")
self.handleMessage(line.rstrip()) self.handleMessage(line.rstrip())
else: else:
pass pass
sleep(0.5)
self.sendEnd(0, {}) self.sendEnd(0, {})
def main(): def main():
@@ -84,6 +84,7 @@ def main():
if start_message["type"] != "start" or "name" not in start_message.keys(): if start_message["type"] != "start" or "name" not in start_message.keys():
print(json.dumps({"error": "Error with the start message"})) print(json.dumps({"error": "Error with the start message"}))
exit() exit()
print("loaded")
song_name = start_message["name"] song_name = start_message["name"]
sc = Scorometer(f"partitions/{song_name}.midi") sc = Scorometer(f"partitions/{song_name}.midi")
sc.gameLoop() sc.gameLoop()