import multiprocessing as mp import os.path import filesystem import log import transcribe USE_FREE=False USE_PAID=True def asyncCreateTranscript(filename): mp.Process(target=createAndSaveTranscript, args=(filename,)).start() def createAndSaveTranscript(filename): if no hasTranscript(filename): try: string = transcribe.transcribeFile(filename) except spr.UnknownValueError: log.log("Audio file is broken or not an audio file.") raise e except spr.RequestError as e: log.log("Could not connect to google API: {}".format(e)) raise e filesystem.saveTranscript(filename, string)