make target folder an argument

This commit is contained in:
Paul Trowbridge 2023-03-27 11:34:47 -04:00
parent dd7851c114
commit c61ec44c3d

View File

@ -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]