diff --git a/.gitignore b/.gitignore index 6b5efc082fa8b5f261078601f901ca8a784b7092..2fd82f2758d73c559bb2fe4bf5f22edac87e2395 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ scripts/360monodepthexecution/rgb.jpg scripts/shifted_t.png scripts/config.ini -*.pyc \ No newline at end of file +*.pyc +.env \ No newline at end of file diff --git a/mona-ssc b/mona-ssc new file mode 160000 index 0000000000000000000000000000000000000000..a0816610da9fa1ed52674240d8343b5643f0e25c --- /dev/null +++ b/mona-ssc @@ -0,0 +1 @@ +Subproject commit a0816610da9fa1ed52674240d8343b5643f0e25c diff --git a/scripts/scene_completion.py b/scripts/scene_completion.py new file mode 100644 index 0000000000000000000000000000000000000000..64f23b773eb3ef5bedc97c0c2103b7641ccb1784 --- /dev/null +++ b/scripts/scene_completion.py @@ -0,0 +1,63 @@ +import paramiko +from dotenv import load_dotenv +from scp import SCPClient +import os + +load_dotenv() +hostname = os.getenv("HOSTNAME") +username = os.getenv("USERNAME") +password = os.getenv("PASSWORD") + +def send_files(shifted_disparity_path, shifted_t_path): + + command = [ + "scp", + shifted_disparity_path, + f"{username}@{hostname}:{os.getenv("REMOTE_INPUT_PATH")}" + ] + try: + subprocess.run(command, check=True) + + except subprocess.CalledProcessError as e: + print(f"Error during SCP: {e}") + return False + + + command = [ + "scp", + shifted_t_path, + f"{username}@{hostname}:{os.getenv("REMOTE_INPUT_PATH")}" + ] + try: + subprocess.run(command, check=True) + + except subprocess.CalledProcessError as e: + print(f"Error during SCP: {e}") + return False + return True + +def get_completed_scene(shifted_disparity_path, shifted_t_path): + if send_files(shifted_disparity_path, shifted_t_path): + + client = paramiko.SSHClient() + client.set_missing_host_key_policy(paramiko.AutoAddPolicy()) + + # Connect to the server + client.connect(hostname, username=username, password=password) + + # Execute commands on the server + stdin, stdout, stderr = client.exec_command("ls -l") + + print("AHAHAHAHAHAHAH\n") + + # Print the output of the command + print(stdout.read()) + + # Close the SSH connection + client.close() + + else: + return False + + +