mirror of
https://github.com/Arrowar/StreamingCommunity.git
synced 2025-06-06 19:45:24 +00:00
Fix configuration file
This commit is contained in:
parent
8cd4108f97
commit
75e6ffc5b0
@ -24,24 +24,26 @@ class ConfigManager:
|
|||||||
try:
|
try:
|
||||||
logging.info(f"Reading file: {self.file_path}")
|
logging.info(f"Reading file: {self.file_path}")
|
||||||
|
|
||||||
# Check if file exist
|
# Check if file exists
|
||||||
if os.path.exists(self.file_path):
|
if os.path.exists(self.file_path):
|
||||||
with open(self.file_path, 'r') as f:
|
with open(self.file_path, 'r') as f:
|
||||||
self.config = json.load(f)
|
self.config = json.load(f)
|
||||||
logging.info("Configuration file loaded successfully.")
|
logging.info("Configuration file loaded successfully.")
|
||||||
|
|
||||||
# Download config.json
|
# Download config.json if it doesn't exist locally
|
||||||
else:
|
else:
|
||||||
|
logging.info("Configuration file does not exist. Downloading...")
|
||||||
self.download_requirements(
|
self.download_requirements(
|
||||||
'https://raw.githubusercontent.com/Lovi-0/StreamingCommunity/refs/heads/main/config.json',
|
'https://raw.githubusercontent.com/Lovi-0/StreamingCommunity/refs/heads/main/config.json',
|
||||||
self.file_path
|
self.file_path
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Load the downloaded config.json into the config attribute
|
||||||
with open(self.file_path, 'r') as f:
|
with open(self.file_path, 'r') as f:
|
||||||
self.config = json.loads(f)
|
self.config = json.load(f)
|
||||||
logging.info("Configuration file downloaded and saved.")
|
logging.info("Configuration file downloaded and saved.")
|
||||||
|
|
||||||
logging.info("Configuration file does not exist. Downloading...")
|
logging.info("Configuration file processed successfully.")
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logging.error(f"Error reading configuration file: {e}")
|
logging.error(f"Error reading configuration file: {e}")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user