This commit is contained in:
Jordon Brooks 2023-08-23 00:54:06 +01:00
parent f4512bba99
commit db43239b3d
5 changed files with 311 additions and 197 deletions

View file

@ -1,6 +1,9 @@
# gobalVars.py
import json
import log
import platform
import os
LOGGER = log.Logger(level="TRACE", logfile="training.log", reset_logfile=True)
@ -9,4 +12,35 @@ NUM_PRESET_SPEEDS = len(PRESET_SPEED_CATEGORIES)
NUM_COLOUR_CHANNELS = 3
WIDTH = 640
HEIGHT = 360
MAX_FRAMES = 0
MAX_FRAMES = 0
def clear_screen():
system_name = platform.system()
if system_name == "Windows":
os.system('cls')
else:
os.system('clear')
def load_video_metadata(list_path):
"""
Load video metadata from a JSON file.
Args:
- json_path (str): Path to the JSON file containing video metadata.
Returns:
- list: List of dictionaries, each containing video details.
"""
LOGGER.trace(f"Entering: load_video_metadata({list_path})")
try:
with open(list_path, "r") as json_file:
file = json.load(json_file)
LOGGER.trace(f"load_video_metadata returning: {file}")
return file
except FileNotFoundError:
LOGGER.error(f"Metadata file {list_path} not found.")
raise
except json.JSONDecodeError:
LOGGER.error(f"Error decoding JSON from {list_path}.")
raise