further adjustsments

This commit is contained in:
jenz 2025-06-06 12:14:38 +02:00
parent aa9785da5a
commit 5e587b1536

View File

@ -187,18 +187,18 @@ def my_file_created_function(event_path):
file_size = None
while True:
time.sleep(10)
stdout, stderr = subprocess.Popen(["ls", "-l", event_path], stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()
#print('stdout: ', stdout)
#print('stderr: ', stderr)
if stderr:
print('finished downloading the bz2 file.')
print('finished downloading the bz2 file. Reconnecting client again.')
writeCfgInput("retry;")
break
user = stdout.decode().split("autismbots")[0]
if whoami not in user:
writeCfgInput("disconnect;")
print("disconnected from server until other user finished downloading bz2 file")
continue
writeCfgInput("disconnect;")
#in case the bz2 download is not progressing just delete the file and disconnect.
cur_file_size = stdout.decode().split("autismbots")[1].strip().split(" ")[0]
@ -209,6 +209,7 @@ def my_file_created_function(event_path):
subprocess.Popen(["rm", event_path], stdout=subprocess.DEVNULL).communicate()[0]
break
file_size = cur_file_size
time.sleep(10)
class NewFileHandler(FileSystemEventHandler):
def on_created(self, event):
@ -295,14 +296,12 @@ if __name__ == '__main__':
print('bot kicked server full: ', datetime.datetime.now().time())
elif "autismo connected to ze" == data:
print('Bot connected to ze!')
#cpulimit_pid_of_game()
is_bot_connected_to_ze2 = False
overwrite_file_access()
elif "not connected to ze2" == data:
is_bot_connected_to_ze2 = False
elif "autismo connected to ze2" == data:
print('Bot connected to ze2!')
#cpulimit_pid_of_game()
is_bot_connected_to_ze2 = True
overwrite_file_access()
elif "connect to ze" == data or ("connect to ze2" == data and not is_bot_connected_to_ze2):