Skip to content

Commit

Permalink
add send_files_to_load to redis_interface.py (#369)
Browse files Browse the repository at this point in the history
  • Loading branch information
mjrosengrant authored Sep 11, 2023
1 parent f7c001d commit 7355cab
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions nanome/beta/redis_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,24 @@ def destroy_stream(self, stream):
args = stream.id
self._send_message(message_type, args, expects_response)

def send_files_to_load(self, files_list):
message_type = Messages.load_file
expects_response = True
files_and_data = []
for file in files_list:
if isinstance(file, tuple):
full_path, file_name = file
file_name += '.' + full_path.split('.')[-1]
else:
full_path = file.replace('\\', '/')
file_name = full_path.split('/')[-1]
with open(full_path, 'rb') as content_file:
data = content_file.read()
files_and_data.append((file_name, data))
fn_args = (files_and_data, True, True) # idk what the True, True does
response = self._send_message(message_type, fn_args, expects_response)
return response

@staticmethod
def _build_message(function_name, request_id, packet=None, expects_response=False):
response_channel = str(uuid.uuid4())
Expand Down

0 comments on commit 7355cab

Please sign in to comment.