import os import toml def load_config(): # Get the user's home directory home_dir = os.path.expanduser("~") # Define the path to the config file config_path = os.path.join(home_dir, ".conf", "social-photos", "conf.toml") # Check if the config file exists if not os.path.exists(config_path): print(f"Config file not found at {config_path}") return None # Load and parse the config file try: with open(config_path, 'r') as config_file: config_data = toml.load(config_file) return config_data except Exception as e: print(f"Error loading config file: {e}") return None # Example usage config = load_config() if config: print("Config loaded successfully:", config) else: print("Failed to load config.") """ TOML FILE EXAMPLE: [image] formats = ['jpg','png'] ## Not currently checked for [flickr] enable = true app_api = '' app_secret = '' watermark = false add_to_description = "\nCheckout my Pixelfed: https://pixelfed.scot/fbface" [pixelfed] #MASTODON_1 (If boost_mastodon is enabled below, this is what will be boosted) enable = true server = 'https://pixelfed.scot' token = '' watermark = false add_to_description = '' [facebook] enable = false api_key = '' watermark = true add_to_desription = '\nCheckout my Pixelfed: https://pixelfed.scot/fbface' [watermark] text = "" #TEXT [boost_mastodon] #Share image posted to Pixelfed to Mastodon enable = true server = 'https://mastodon.online' token = '' add_to_description = '' """