diff --git a/TTS/TikTok.py b/TTS/TikTok.py index 743118c..9fa83b7 100644 --- a/TTS/TikTok.py +++ b/TTS/TikTok.py @@ -94,6 +94,7 @@ class TikTok: # TikTok Text-to-Speech Wrapper vstr = [r.json()["data"]["v_str"]][0] b64d = base64.b64decode(vstr) + with open(filepath, "wb") as out: out.write(b64d) diff --git a/TTS/engine_wrapper.py b/TTS/engine_wrapper.py index e41e55c..e8643e1 100644 --- a/TTS/engine_wrapper.py +++ b/TTS/engine_wrapper.py @@ -84,9 +84,9 @@ class TTSEngine: ) clip_length = audio_length(f'assets/temp/mp3/{filename}.mp3') - print(clip_length, '/', self.__total_length) + print(clip_length, '/', self.__total_length) # TODO remove debug - if self.__total_length + clip_length <= self.max_length: + if clip_length and self.__total_length + clip_length <= self.max_length: self.__total_length += clip_length return True return False diff --git a/video_creation/data/videos.json b/video_creation/data/videos.json index 0637a08..0a1ca06 100644 --- a/video_creation/data/videos.json +++ b/video_creation/data/videos.json @@ -1 +1,10 @@ -[] \ No newline at end of file +[ + { + "subreddit": "AskReddit", + "id": "vwgslz", + "time": "1657565829", + "background_credit": "bbswitzer", + "reddit_title": "Which singer should never have been famous", + "filename": "Which singer should never have been famous.mp4" + } +] \ No newline at end of file diff --git a/video_creation/final_video.py b/video_creation/final_video.py index 9989415..5a9a5b0 100755 --- a/video_creation/final_video.py +++ b/video_creation/final_video.py @@ -28,6 +28,7 @@ from video_creation.background import download_background, chop_background_video console = Console() W, H = 1080, 1920 # TODO move to config + max_length: int = 50 # TODO move to config