database , chat vod and shorts update error messages
This commit is contained in:
@@ -7,3 +7,5 @@ __pycache__
|
|||||||
twitch_secrets.json
|
twitch_secrets.json
|
||||||
.vscode/settings.json
|
.vscode/settings.json
|
||||||
download
|
download
|
||||||
|
output.log
|
||||||
|
*.mp4
|
||||||
|
|||||||
+4
-2
@@ -33,7 +33,7 @@ def build_chat_video():
|
|||||||
print(f"🚀 Transcribe: {title}")
|
print(f"🚀 Transcribe: {title}")
|
||||||
print("====================================================")
|
print("====================================================")
|
||||||
|
|
||||||
twitch_chat_vod.combine_twitch_vod_and_chat(f"download/videos/{id}/{id}.mp4", "overlay")
|
twitch_chat_vod.combine_twitch_vod_and_chat(f"download/videos/{id}/{id}.mp4")
|
||||||
|
|
||||||
|
|
||||||
def build_transcribe():
|
def build_transcribe():
|
||||||
@@ -106,4 +106,6 @@ def build_shorts():
|
|||||||
|
|
||||||
if __name__ =="__main__":
|
if __name__ =="__main__":
|
||||||
DB = database.Database()
|
DB = database.Database()
|
||||||
build_shorts()
|
#build_shorts()
|
||||||
|
build_transcribe()
|
||||||
|
build_chat_video()
|
||||||
+4
-4
@@ -80,18 +80,18 @@ class Database:
|
|||||||
"""Flags a specific row record to downloaded (0)."""
|
"""Flags a specific row record to downloaded (0)."""
|
||||||
self.__mark_as(record_id, "downloaded", "0")
|
self.__mark_as(record_id, "downloaded", "0")
|
||||||
|
|
||||||
def __get_unuploaded(self, set_row: str) -> list[Any]:
|
def __get_unuploaded(self, set_row: str, also: str = "") -> list[Any]:
|
||||||
"""Retrieve all rows that were download but not uploaded"""
|
"""Retrieve all rows that were download but not uploaded"""
|
||||||
self.cursor.execute(f"SELECT {self.columns} FROM twitch_videos WHERE downloaded = 1 AND {set_row} = 0")
|
self.cursor.execute(f"SELECT {self.columns} FROM twitch_videos WHERE downloaded = 1 AND {set_row} = 0 {also}")
|
||||||
return self.cursor.fetchall()
|
return self.cursor.fetchall()
|
||||||
|
|
||||||
def get_unuploaded_shorts(self) -> list[Any]:
|
def get_unuploaded_shorts(self) -> list[Any]:
|
||||||
"""Retrieve all rows that were download but not uploaded_yt_shorts"""
|
"""Retrieve all rows that were download but not uploaded_yt_shorts"""
|
||||||
return self.__get_unuploaded("uploaded_yt_shorts")
|
return self.__get_unuploaded("uploaded_yt_shorts", "AND clip_is = 1")
|
||||||
|
|
||||||
def get_unuploaded_chats(self) -> list[Any]:
|
def get_unuploaded_chats(self) -> list[Any]:
|
||||||
"""Retrieve all rows that were download but not uploaded_yt_chats"""
|
"""Retrieve all rows that were download but not uploaded_yt_chats"""
|
||||||
return self.__get_unuploaded("uploaded_yt_chats")
|
return self.__get_unuploaded("uploaded_yt_chats", "AND clips_is = 0")
|
||||||
|
|
||||||
def get_unuploaded(self) -> list[Any]:
|
def get_unuploaded(self) -> list[Any]:
|
||||||
"""Retrieve all rows that were download but not uploaded_yt"""
|
"""Retrieve all rows that were download but not uploaded_yt"""
|
||||||
|
|||||||
+5
-1
@@ -2,7 +2,7 @@
|
|||||||
import os
|
import os
|
||||||
import linux
|
import linux
|
||||||
|
|
||||||
def combine_twitch_vod_and_chat(vod_path: str, layout: str = "side-by-side") -> bool:
|
def combine_twitch_vod_and_chat(vod_path: str, layout: str = "side-by-side", force: bool = False) -> bool:
|
||||||
"""
|
"""
|
||||||
Renders Twitch chat JSON to video and combines it with the source VOD.
|
Renders Twitch chat JSON to video and combines it with the source VOD.
|
||||||
Provides real-time terminal feedback for all processing steps.
|
Provides real-time terminal feedback for all processing steps.
|
||||||
@@ -14,6 +14,10 @@ def combine_twitch_vod_and_chat(vod_path: str, layout: str = "side-by-side") ->
|
|||||||
mask_path = video_path.replace(".mp4", "_temp_chat_mask.mp4")
|
mask_path = video_path.replace(".mp4", "_temp_chat_mask.mp4")
|
||||||
|
|
||||||
# Step 1: Pre-flight checks
|
# Step 1: Pre-flight checks
|
||||||
|
if os.path.exists(video_chat) and force is False:
|
||||||
|
print(f"❌ Error: Chat video allready exists: {video_chat}")
|
||||||
|
return False
|
||||||
|
|
||||||
if not os.path.exists(video_path):
|
if not os.path.exists(video_path):
|
||||||
print(f"❌ Error: Source video not found: {video_path}")
|
print(f"❌ Error: Source video not found: {video_path}")
|
||||||
return False
|
return False
|
||||||
|
|||||||
+7
-1
@@ -1,4 +1,5 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
import os
|
||||||
import linux
|
import linux
|
||||||
import tempfile
|
import tempfile
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
@@ -20,11 +21,16 @@ def apply_gaussian_blur(frame, radius: int = 30):
|
|||||||
# Return back as a numpy array for MoviePy
|
# Return back as a numpy array for MoviePy
|
||||||
return np.array(blurred_image)
|
return np.array(blurred_image)
|
||||||
|
|
||||||
def fit_to_9_16_letterbox(input_path: str, top_text: str = "TOP TEXT", bottom_text: str = "BOTTOM TEXT", use_blur: bool = True):
|
def fit_to_9_16_letterbox(input_path: str, top_text: str = "TOP TEXT", bottom_text: str = "BOTTOM TEXT", use_blur: bool = True, force: bool = False):
|
||||||
input_file = Path(input_path)
|
input_file = Path(input_path)
|
||||||
output_suffix = "gaussian_9_16" if use_blur else "black_9_16"
|
output_suffix = "gaussian_9_16" if use_blur else "black_9_16"
|
||||||
output_path = input_file.parent / f"{input_file.stem}_{output_suffix}{input_file.suffix}"
|
output_path = input_file.parent / f"{input_file.stem}_{output_suffix}{input_file.suffix}"
|
||||||
|
|
||||||
|
if os.path.exists(output_path) and force is False:
|
||||||
|
print(f"❌ Error: Short video allready exists: {output_path}")
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
print("🧼 Sanitizing video metadata streams inside an automated safe context...")
|
print("🧼 Sanitizing video metadata streams inside an automated safe context...")
|
||||||
with tempfile.NamedTemporaryFile(suffix=input_file.suffix, delete=False) as temp_file:
|
with tempfile.NamedTemporaryFile(suffix=input_file.suffix, delete=False) as temp_file:
|
||||||
temp_path = temp_file.name
|
temp_path = temp_file.name
|
||||||
|
|||||||
Reference in New Issue
Block a user