update short scripts

This commit is contained in:
2026-07-21 16:50:05 -04:00
parent 19e525d64c
commit 8e4a34dce1
6 changed files with 179 additions and 28 deletions
+8 -8
View File
@@ -29,9 +29,9 @@ def run_linux_command(command: str):
# Handles errors if the Linux command returns a non-zero exit code
return {"success": False, "stdout": e.stdout, "stderr": e.stderr}
def transcribe(slug: str):
def transcribe(id: str):
"""Transcribes the Video File."""
video_file = f"save/{DB.table}/{slug}/{slug}.mp4"
video_file = f"save/{DB.table}/{id}/{id}.mp4"
# Check if the video file exists
if not os.path.exists(video_file):
@@ -39,18 +39,18 @@ def transcribe(slug: str):
return False
# no need to continue if srt transcribe file already exists
if os.path.exists(f"save/{DB.table}/{slug}/transcribe_{slug}.srt"):
if os.path.exists(f"save/{DB.table}/{id}/transcribe_{id}.srt"):
print(f"video already transcribed:")
return True
transcribe_video.extract_audio(video_file, f"save/{DB.table}/{slug}/temp_{slug}_audio.wav")
transcribe_video.transcribe_to_srt(f"save/{DB.table}/{slug}/temp_{slug}_audio.wav", f"save/{DB.table}/{slug}/", f"transcribe_{slug}")
transcribe_video.extract_audio(video_file, f"save/{DB.table}/{id}/temp_{id}_audio.wav")
transcribe_video.transcribe_to_srt(f"save/{DB.table}/{id}/temp_{id}_audio.wav", f"save/{DB.table}/{id}/", f"transcribe_{id}")
return True
def top_hashtags(slug: str):
def top_hashtags(id: str):
""""Hashtags from transcribed SRT file."""
file_srt = f"save/{DB.table}/{slug}/transcribe_{slug}.srt"
file_srt = f"save/{DB.table}/{id}/transcribe_{id}.srt"
# if srt transcribe file not exists
if not os.path.exists(file_srt):
@@ -99,7 +99,7 @@ def upload():
unuploaded = DB.get_unuploaded()
twitch_datetime = " #Twitch Every Friday and Sunday @7:30 EST https://twitch.tv/teampgp"
twitch_datetime = " Live on Twitch Every Friday and Sunday @7:30 ET https://twitch.tv/teampgp"
file_path = ""
title = ""
description = ""