created new files for transcribing videos , find tranding hashtags

This commit is contained in:
2026-07-18 20:45:22 -04:00
parent 483a771575
commit 0505d2a581
8 changed files with 460 additions and 62 deletions
+42 -7
View File
@@ -22,13 +22,46 @@ def run_linux_command(command: str):
except subprocess.CalledProcessError as e:
return {"success": False, "stdout": e.stdout, "stderr": e.stderr}
def transcribe(slug: str):
"""Transcribes the Video File."""
video_file = f"save/clips/{slug}/{slug}.mp4"
# Check if the video file exists
if not os.path.exists(video_file):
print(f"Error: File not found: {video_file}")
return False
# no need to continue if srt transcribe file already exists
if os.path.exists(f"save/clips/{slug}/transcribe_{slug}.srt"):
print(f"video already transcribed:")
return True
import transcribe_video
transcribe_video.extract_audio(video_file, f"save/clips/{slug}/temp_{slug}_audio.wav")
transcribe_video.transcribe_to_srt(f"save/clips/{slug}/temp_{slug}_audio.wav", f"save/clips/{slug}/", f"transcribe_{slug}")
return True
def top_hashtags(slug: str):
file_srt = f"save/clips/{slug}/transcribe_{slug}.srt"
# if srt transcribe file not exists
if not os.path.exists(file_srt):
print(f"Transcribe file not found {file_srt}")
return []
import youtube_hashtags
return youtube_hashtags.get_top_hashtags(file_srt)
def download_clips():
"""Loops over undownloaded metadata entries to write files down locally."""
undownloaded_clips = DB.get_undownloaded()
print("Downloading Clips...")
for slug, record_date, title, game_name, clip_by, views, downloaded, uploaded_yt in undownloaded_clips:
for slug, record_date, title, game_name, clip_by, views, downloaded, uploaded_yt, uploaded_shorts_yt in undownloaded_clips:
print(f"Slug: {slug} | Date: {record_date} | Game: {game_name} | By: {clip_by} | Views: {views} | Title: {title}")
# Uses standard clipdownload directive
@@ -44,23 +77,25 @@ def download_clips():
def upload_clips():
"""Loops over the downloaded videos entries and uploaded them to youtube."""
print("Uploading Clips...")
print(f"Uploading Clips...")
unpuloaded_clips = DB.get_unuploaded()
unuploaded_clips = DB.get_unuploaded()
categoryId = CategoryId.GAMING
for slug, record_date, title, game_name, clip_by, views, downloaded, uploaded_yt in unpuloaded_clips:
for slug, record_date, title, game_name, clip_by, views, downloaded, uploaded_yt in unuploaded_clips:
print(f"Slug: {slug} | Date: {record_date} | Game: {game_name} | By: {clip_by} | Views: {views} | Title: {title}")
file_path = f"save/clips/{slug}/{slug}.mp4"
title = title
description = f"Game: {game_name}, Cliped By: {clip_by}, on {record_date}, #Shorts #Clips #Twitch"
description = f"Game: {game_name}, Cliped By: {clip_by}, on {record_date}, #Shorts #Clips #Twitch Every Friday and Sunday @7:30 EST https://twitch.tv/teampgp"
categoryId = CategoryId.GAMING
privatcyStatus = 'private'
tags = ['shorts', 'gaming', 'TeamPGP', f'{game_name}', f'{clip_by}', 'twitch_clips', 'clips']
tags = ['shorts', 'gaming', 'TeamPGP', f'{game_name}', f'{clip_by}', 'twitch_clips', 'clips', 'Level1Techs', 'twitch']
output = uploader.upload_video(file_path, title, categoryId, description, privatcyStatus, tags)
tags.extend(top_hashtags({slug}))
#output = uploader.upload_video(file_path, title, categoryId, description, privatcyStatus, tags)
if output is True:
print(f"Slug: {slug} | Was successfully uploaded.")