CDRM-Keys/CDRM_Modules/CDM_Selector.py
2024-09-16 13:28:01 -04:00

27 lines
849 B
Python

#Import dependencies
from distutils.command.config import config
import yaml
from InquirerPy import inquirer
import os
# Define function to choose local CDM
def select_local_cdm():
files_in_wvds_folder = os.listdir(f'{os.getcwd()}/WVDs')
wvds = [file for file in files_in_wvds_folder if file.endswith('.wvd')]
choice = inquirer.select(
message=f'\nChoose the WVD you wish to use:',
choices=wvds,
).execute()
return choice
# Define function to choose remote CDM
def select_remote_cdm():
with open(f'{os.getcwd()}/Config.yaml', 'r') as ymlfile:
config = yaml.safe_load(ymlfile)
remote_cdms = [remotecdm for remotecdm in config['Remote_CDMs']]
choice = inquirer.select(
message=f'\nChoose the Remote CDM you wish to use:',
choices=remote_cdms,
).execute()
return choice