added a basic validator check

This commit is contained in:
Jun-te Kim 2025-03-03 15:25:39 +00:00
parent c2f94afde4
commit 8e6ba54ccb
2 changed files with 35 additions and 3 deletions

View file

@ -0,0 +1,22 @@
import logging
import os
class Logger:
def __init__(self, name, level=logging.INFO):
# Create a custom logger
self.logger = logging.getLogger(name)
self.logger.setLevel(level)
# Create handlers
c_handler = logging.StreamHandler()
c_handler.setLevel(level)
# Create formatters and add it to handlers
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
c_handler.setFormatter(formatter)
# Add handlers to the logger
self.logger.addHandler(c_handler)
def get_logger(self):
return self.logger

View file

@ -1,12 +1,22 @@
import os
from utils.logger import Logger
class RetroHomeFileStructureValidator():
def __init__(self, source_loc_path):
self.source_path = source_loc_path
self.correct_names = []
self.incorrect_names = []
self.logger = Logger(name='RetroHomeFileStructureValidator').get_logger()
self.innocent = []
self.guilty = []
self.validate()
def validate(self):
print("nothing to validate")
self.logger.info(f"Starting File Structure Validation on '{self.source_path}'")
for filepath in os.listdir(self.source_path):
if os.path.isdir(os.path.join(self.source_path, filepath)):
self.logger.info(f"Its a file {filepath}")
else:
self.logger.warning(f"Found a file when expecting directory. Ignoring file {filepath}")
def valid_name(name):
pass