Skip to content

Commit

Permalink
Update subgen.py
Browse files Browse the repository at this point in the history
  • Loading branch information
McCloudS authored Mar 19, 2024
1 parent 195a146 commit 8a95c15
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions subgen/subgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -615,15 +615,16 @@ def path_mapping(fullpath):
return fullpath.replace(path_mapping_from, path_mapping_to)
return fullpath

# Define a handler class that will process new files
class NewFileHandler(FileSystemEventHandler):
def on_created(self, event):
# Only process if it's a file
if not event.is_directory:
file_path = event.src_path
# Call the gen_subtitles function
logging.info(f"File: {path_mapping(file_path)} was added")
gen_subtitles(path_mapping(file_path), transcribe_or_translate, False)
if monitor:
# Define a handler class that will process new files
class NewFileHandler(FileSystemEventHandler):
def on_created(self, event):
# Only process if it's a file
if not event.is_directory:
file_path = event.src_path
# Call the gen_subtitles function
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):
transcribe_folders = transcribe_folders.split("|")
Expand Down

0 comments on commit 8a95c15

Please sign in to comment.