This repository has been archived on 2025-05-04. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
DeepEncode/globalVars.py
2023-08-23 21:01:01 +01:00

46 lines
No EOL
1.2 KiB
Python

# gobalVars.py
import json
import log
import platform
import os
LOGGER = log.Logger(level="TRACE", logfile="training.log", reset_logfile=True)
PRESET_SPEED_CATEGORIES = ["ultrafast", "superfast", "veryfast", "faster", "fast", "medium", "slow", "slower", "veryslow"]
NUM_PRESET_SPEEDS = len(PRESET_SPEED_CATEGORIES)
NUM_COLOUR_CHANNELS = 3
WIDTH = 640
HEIGHT = 360
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