Wrap transcription attempt in a try/except
If the audio file is empty or has no discernable human voices, the transcription may fail with an exception. Record that when it happens and move continue to the next file, rather than failing.
This commit is contained in:
parent
34a0b1b639
commit
674819baeb
20
tcd.py
20
tcd.py
|
@ -188,11 +188,23 @@ def main():
|
|||
print("NOTICE: No new entries found to transcribe.")
|
||||
sys.exit(0)
|
||||
|
||||
eprint("Transcribing: {}".format(", ".join(files_to_transcribe)))
|
||||
eprint(
|
||||
"Transcribing {} files: {}".format(
|
||||
str(len(files_to_transcribe)), ", ".join(files_to_transcribe)
|
||||
)
|
||||
)
|
||||
for index, f in enumerate(files_to_transcribe):
|
||||
transcribe_with_timestamp(os.path.join(tcd_path, f))
|
||||
if index != len(files):
|
||||
print("\n\n")
|
||||
eprint(
|
||||
"Transcribing file {}: {} ({})".format(
|
||||
index + 1, f, converttcdfilename(f)
|
||||
)
|
||||
)
|
||||
try:
|
||||
transcribe_with_timestamp(os.path.join(tcd_path, f))
|
||||
if index != len(files):
|
||||
print("\n\n")
|
||||
except:
|
||||
eprint("Transcription failed!")
|
||||
|
||||
writelast(files_to_transcribe[-1])
|
||||
sys.exit(0)
|
||||
|
|
Loading…
Reference in New Issue