'commit'
This commit is contained in:
38
DouYin/run_transcription_loop.py
Normal file
38
DouYin/run_transcription_loop.py
Normal file
@@ -0,0 +1,38 @@
|
||||
|
||||
import os
|
||||
import subprocess
|
||||
import time
|
||||
import sys
|
||||
|
||||
def run_loop():
|
||||
audio_dir = r"d:\dsWork\aiData\DouYin\Audios"
|
||||
transcript_dir = r"d:\dsWork\aiData\DouYin\Transcripts"
|
||||
script_path = r"d:\dsWork\aiData\DouYin\transcribe_videos.py"
|
||||
|
||||
while True:
|
||||
# Get list of mp3s
|
||||
mp3s = [f for f in os.listdir(audio_dir) if f.endswith(".mp3")]
|
||||
# Get list of txts
|
||||
if os.path.exists(transcript_dir):
|
||||
txts = [f for f in os.listdir(transcript_dir) if f.endswith(".txt")]
|
||||
else:
|
||||
txts = []
|
||||
|
||||
print(f"Progress: {len(txts)}/{len(mp3s)}")
|
||||
|
||||
if len(txts) >= len(mp3s):
|
||||
print("All files processed!")
|
||||
break
|
||||
|
||||
print("Running transcribe_videos.py...")
|
||||
result = subprocess.run([sys.executable, script_path], capture_output=True, text=True)
|
||||
print(result.stdout)
|
||||
print(result.stderr)
|
||||
|
||||
# Check if we are making progress?
|
||||
# If we loop too fast without progress, we should stop.
|
||||
# But for now, let's just loop.
|
||||
time.sleep(1)
|
||||
|
||||
if __name__ == "__main__":
|
||||
run_loop()
|
||||
Reference in New Issue
Block a user