INNER CODE UNIT · Python

modify_plex_config

ahembree/ansible-hms-docker · roles/hmsdocker/files/scripts/traefik_cert_convert.py:77

def modify_plex_config(config_path: str, attrib_key: str, attrib_value: str) -> None:
    """Modifies the Plex server config XML file to have expected values output by this script

    Args:
        config_path (``str``): The path to the Plex "Preferences.xml" file
        attrib_key (``str``): The attribute key to update
        attrib_value (``str``): The value to assign to the attribute key
    """    
    try:
        logging.debug(f'Trying to load Plex config from {config_path}')
        xml_tree = ET.parse(config_path)
    except FileNotFoundError as e:
        logging.error(f'Failed to find config file at location: {config_path} for reason: {e}')
        sys.exit(1)
    except PermissionError as e:
        logging.error(f'Failed to read config file, permission denied, try running as root? {e}')
        sys.exit(1)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…