From c61ec44c3df0188cfb2e0df3a21ecccbb5b58ba6 Mon Sep 17 00:00:00 2001 From: Paul Trowbridge Date: Mon, 27 Mar 2023 11:34:47 -0400 Subject: [PATCH] make target folder an argument --- transcribe.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/transcribe.py b/transcribe.py index e6cda5d..bc386cd 100644 --- a/transcribe.py +++ b/transcribe.py @@ -1,4 +1,5 @@ import requests +import argparse import psycopg2 import json import os @@ -33,11 +34,15 @@ data = { 'model': 'whisper-1' } -dir_path = '//mnt/c/Users/PTrowbridge/Downloads/trans' +# Parse command-line arguments +parser = argparse.ArgumentParser() +parser.add_argument('dir_path', help='path to directory containing audio files to transcribe') +args = parser.parse_args() + # Define the audio file to be transcribed -for file_name in os.listdir(dir_path): +for file_name in os.listdir(args.dir_path): if file_name.endswith('.wav'): - file_path = os.path.join(dir_path, file_name) + file_path = os.path.join(args.dir_path, file_name) file_name = os.path.basename(file_path) file_date = file_name[:10]