Skip to content

Commit

Permalink
Merge pull request #425 from mydroidandi/fb/estebanways
Browse files Browse the repository at this point in the history
Fb/estebanways
  • Loading branch information
estebanways authored Feb 26, 2024
2 parents 68b6221 + e93eba5 commit 5117f61
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 43 deletions.
49 changes: 9 additions & 40 deletions bundles/commbase-data-exchange/client/file_paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,16 @@
from config import CONFIG_FILE_DIR, CONFIG_FILE_PATH


def get_xyz_directory():
def get_messaging_file():
"""
Retrieves the directory path of xyz from the configuration
file.
Retrieves the value of the MESSAGING_FILE variable from the
configuration file.
Returns:
str or None: The directory path of the xyz if found, or None
if not found.
str or None: The value of the variable if found, or None if not found.
"""
# Initialize variable
xyz_directory = None
recording_file = None

# Open the file and read its contents
with open(CONFIG_FILE_PATH, "r") as f:
Expand All @@ -57,13 +56,13 @@ def get_xyz_directory():
variable_name, value = line.strip().split("=")

# Check if the variable we are looking for exists in the line
if variable_name == "XYZZZZZ_DIRECTORY":
if variable_name == "MESSAGING_FILE":
# Remove the quotes from the value of the variable
xyz_directory = CONFIG_FILE_DIR + value.strip()[1:-1]
recording_file = CONFIG_FILE_DIR + value.strip()[1:-1]

# Check if the variable was found
if xyz_directory is not None:
return xyz_directory
if recording_file is not None:
return recording_file

# If the variable was not found, return None
return None
Expand Down Expand Up @@ -97,33 +96,3 @@ def get_ca_pem_file_path():

# If the variable was not found, return None
return None


def get_messaging_file():
"""
Retrieves the value of the MESSAGING_FILE variable from the
configuration file.
Returns:
str or None: The value of the variable if found, or None if not found.
"""
# Initialize variable
recording_file = None

# Open the file and read its contents
with open(CONFIG_FILE_PATH, "r") as f:
for line in f:
# Split the line into variable name and value
variable_name, value = line.strip().split("=")

# Check if the variable we are looking for exists in the line
if variable_name == "MESSAGING_FILE":
# Remove the quotes from the value of the variable
recording_file = CONFIG_FILE_DIR + value.strip()[1:-1]

# Check if the variable was found
if recording_file is not None:
return recording_file

# If the variable was not found, return None
return None
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@

import subprocess


def read_json_file(json_file_path):
try:
with open(json_file_path, 'r') as json_file:
Expand Down Expand Up @@ -124,5 +125,6 @@ def main():
except Exception as e:
print(f"Other error occurred: {e}")


if __name__ == "__main__":
main()
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

from config import CONFIG_FILE_PATH
from file_paths import (
get_ca_pem_file_path
get_ca_pem_file_path, # TODO: Verify if you really need this!
get_messaging_file
)

Expand Down
30 changes: 30 additions & 0 deletions bundles/commbase-data-exchange/server/file_paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,36 @@ def get_xyz_directory():
return None


def get_messaging_file():
"""
Retrieves the value of the MESSAGING_FILE variable from the
configuration file.
Returns:
str or None: The value of the variable if found, or None if not found.
"""
# Initialize variable
recording_file = None

# Open the file and read its contents
with open(CONFIG_FILE_PATH, "r") as f:
for line in f:
# Split the line into variable name and value
variable_name, value = line.strip().split("=")

# Check if the variable we are looking for exists in the line
if variable_name == "MESSAGING_FILE":
# Remove the quotes from the value of the variable
recording_file = CONFIG_FILE_DIR + value.strip()[1:-1]

# Check if the variable was found
if recording_file is not None:
return recording_file

# If the variable was not found, return None
return None


def get_server_crt_file_path():
"""
Retrieves the value of the CERTS_AND_KEYS_SERVER_CRT_FILE variable from the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@

from config import CONFIG_FILE_PATH
from file_paths import (
get_ca_pem_file_path
get_messaging_file
get_ca_pem_file_path,
get_messaging_file # TODO: Verify if you really need this

)

Expand Down
1 change: 1 addition & 0 deletions bundles/commbase-stt-whisper-p/file_paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
# Requirements
from config import CONFIG_FILE_DIR, CONFIG_FILE_PATH


def get_chat_log_file():
"""
Retrieves the value of the CHAT_LOG_FILE variable from the configuration
Expand Down

0 comments on commit 5117f61

Please sign in to comment.