fix and working Clips downloader/uploader

This commit is contained in:
2026-07-17 23:08:26 -04:00
parent 8be00d16d1
commit 483a771575
5 changed files with 101 additions and 21 deletions
+10 -8
View File
@@ -24,21 +24,21 @@ def run_linux_command(command: str):
def download_clips():
"""Loops over undownloaded metadata entries to write files down locally."""
undownloaded_clips = get_undownloaded_clips()
undownloaded_clips = DB.get_undownloaded()
print("Downloading Clips...")
for slug, record_date, title, game_name, clip_by, views, downloaded in undownloaded_clips:
for slug, record_date, title, game_name, clip_by, views, downloaded, uploaded_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
output = run_linux_command(f"TwitchDownloaderCLI clipdownload --id {slug} -o save/clips/{slug}/{title}.mp4")
output = run_linux_command(f"TwitchDownloaderCLI clipdownload --id {slug} -o save/clips/{slug}/{slug}.mp4")
if output["success"] is True:
print(f"Slug: {slug} | Was successfully downloaded.")
DB.mark_as_downloaded(slug)
else:
print(f"Slug: {slug} | Download Process failed.")
print(f"Slug: {slug} | Download Process failed. {output["stdout"]}. Error: {output["stderr"]}")
print("Finished Downloading Clips...")
@@ -46,19 +46,21 @@ def upload_clips():
"""Loops over the downloaded videos entries and uploaded them to youtube."""
print("Uploading Clips...")
unpuloaded_clips = get_unuploaded_clips()
unpuloaded_clips = DB.get_unuploaded()
categoryId = CategoryId.GAMING
for slug, record_date, title, game_name, clip_by, views, downloaded, uploaded_yt in unpuloaded_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"
description = f"Game: {game_name}, Cliped By: {clip_by}, on {record_date}, #Shorts #Clips #Twitch"
categoryId = CategoryId.GAMING
privatcyStatus = 'private'
tags = ['shorts', 'gaming', 'TeamPGP', f'{game_name}', f'{clip_by}']
tags = ['shorts', 'gaming', 'TeamPGP', f'{game_name}', f'{clip_by}', 'twitch_clips', 'clips']
output = uploader.upload_video(file_path, title, description, categoryId, privatcyStatus, tags)
output = uploader.upload_video(file_path, title, categoryId, description, privatcyStatus, tags)
if output is True:
print(f"Slug: {slug} | Was successfully uploaded.")