update database to use sqlalchemy
This commit is contained in:
1 parent
2773200a94
commit
61fe9eca25
9 files changed
+267
-170
No files matched your search
+10
-69
@@ -10,76 +10,36 @@ from package.config import TZ as TZ
|
||||
def build_chat_video():
|
||||
chats = DB.get_unuploaded_chats()
|
||||
|
||||
for chat in chats:
|
||||
(
|
||||
id,
|
||||
title,
|
||||
created_at,
|
||||
view_count,
|
||||
duration,
|
||||
url,
|
||||
thumbnail_url,
|
||||
game_id,
|
||||
game_name,
|
||||
stream_id,
|
||||
creator_name,
|
||||
clip_is,
|
||||
downloaded,
|
||||
uploaded_yt,
|
||||
uploaded_yt_chats,
|
||||
uploaded_yt_shorts,
|
||||
) = chat
|
||||
|
||||
for chat in chats:
|
||||
print("====================================================")
|
||||
print(f"🚀 Chat Video: {title}")
|
||||
print(f"🚀 Chat Video: {chat.title}")
|
||||
print("====================================================")
|
||||
|
||||
chat_vod.combine_twitch_vod_and_chat(f"download/videos/{id}/{id}.mp4", "side-by-side")
|
||||
chat_vod.combine_twitch_vod_and_chat(f"download/videos/{chat.id}/{chat.id}.mp4", "side-by-side")
|
||||
|
||||
print("====================================================")
|
||||
print(f"✅ Processing: Chat Video Done.")
|
||||
print("====================================================")
|
||||
|
||||
|
||||
def build_transcribe():
|
||||
unuploadeds = DB.get_unuploaded()
|
||||
|
||||
for unuploaded in unuploadeds:
|
||||
(
|
||||
id,
|
||||
title,
|
||||
created_at,
|
||||
view_count,
|
||||
duration,
|
||||
url,
|
||||
thumbnail_url,
|
||||
game_id,
|
||||
game_name,
|
||||
stream_id,
|
||||
creator_name,
|
||||
clip_is,
|
||||
downloaded,
|
||||
uploaded_yt,
|
||||
uploaded_yt_chats,
|
||||
uploaded_yt_shorts,
|
||||
) = unuploaded
|
||||
|
||||
if clip_is:
|
||||
if unuploaded.clip_is:
|
||||
target_dir = f"download/clips"
|
||||
else:
|
||||
target_dir = f"download/videos"
|
||||
|
||||
print("====================================================")
|
||||
print(f"🚀 Transcribe: {title}")
|
||||
print(f"🚀 Transcribe: {unuploaded.title}")
|
||||
print("====================================================")
|
||||
|
||||
transcribe_video.transcribe_to_srt(f"{target_dir}/{id}/{id}.mp4")
|
||||
transcribe_video.transcribe_to_srt(f"{target_dir}/{unuploaded.id}/{unuploaded.id}.mp4")
|
||||
|
||||
print("====================================================")
|
||||
print(f"✅ Processing: Transcribing Done.")
|
||||
print("====================================================")
|
||||
|
||||
|
||||
def build_shorts():
|
||||
shorts = DB.get_unuploaded_shorts()
|
||||
|
||||
@@ -87,37 +47,18 @@ def build_shorts():
|
||||
count = 1
|
||||
|
||||
for short in shorts:
|
||||
(
|
||||
id,
|
||||
title,
|
||||
created_at,
|
||||
view_count,
|
||||
duration,
|
||||
url,
|
||||
thumbnail_url,
|
||||
game_id,
|
||||
game_name,
|
||||
stream_id,
|
||||
creator_name,
|
||||
clip_is,
|
||||
downloaded,
|
||||
uploaded_yt,
|
||||
uploaded_yt_chats,
|
||||
uploaded_yt_shorts,
|
||||
) = short
|
||||
|
||||
target_dir = f"download/clips/{id}/{id}.mp4"
|
||||
target_dir = f"download/clips/{short.id}/{short.id}.mp4"
|
||||
|
||||
print("====================================================")
|
||||
print(f"🚀 Processing: Clip to Youtube Short {title}")
|
||||
print(f"🚀 Processing: Clip to Youtube Short {short.title}")
|
||||
print("====================================================")
|
||||
print(f"{count}/{len(shorts)}")
|
||||
|
||||
created_at = datetime.strptime(created_at, "%Y-%m-%d %H:%M:%S%z")
|
||||
created_at = datetime.strptime(short.created_at, "%Y-%m-%d %H:%M:%S%z")
|
||||
created_at = created_at.astimezone(TZ)
|
||||
|
||||
#ToDo
|
||||
yt_shorts.fit_to_9_16_letterbox(target_dir, top_txt, f"Clipped By: {creator_name},\n on {created_at.strftime("%Y-%m-%d %H:%M:%S %Z")}", True, True)
|
||||
yt_shorts.fit_to_9_16_letterbox(target_dir, top_txt, f"Clipped By: {short.creator_name},\n on {created_at.strftime("%Y-%m-%d %H:%M:%S %Z")}")
|
||||
count += 1
|
||||
|
||||
print("====================================================")
|
||||
|
||||
Reference in new issue
Block a user