Update subgen.py

This commit is contained in:
McCloudS
2024-03-19 11:51:35 -06:00
committed by GitHub
parent 195a146758
commit 8a95c15d88

View File

@@ -615,15 +615,16 @@ def path_mapping(fullpath):
return fullpath.replace(path_mapping_from, path_mapping_to) return fullpath.replace(path_mapping_from, path_mapping_to)
return fullpath return fullpath
# Define a handler class that will process new files if monitor:
class NewFileHandler(FileSystemEventHandler): # Define a handler class that will process new files
def on_created(self, event): class NewFileHandler(FileSystemEventHandler):
# Only process if it's a file def on_created(self, event):
if not event.is_directory: # Only process if it's a file
file_path = event.src_path if not event.is_directory:
# Call the gen_subtitles function file_path = event.src_path
logging.info(f"File: {path_mapping(file_path)} was added") # Call the gen_subtitles function
gen_subtitles(path_mapping(file_path), transcribe_or_translate, False) logging.info(f"File: {path_mapping(file_path)} was added")
gen_subtitles(path_mapping(file_path), transcribe_or_translate, False)
def transcribe_existing(transcribe_folders, forceLanguage=None): def transcribe_existing(transcribe_folders, forceLanguage=None):
transcribe_folders = transcribe_folders.split("|") transcribe_folders = transcribe_folders.split("|")