Merge branch 'develop' into ux-changes

pull/354/head
null3000 3 years ago committed by GitHub
commit bfd98d1da9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -16,5 +16,14 @@ THEME=""
# Enter a subreddit, e.g. "AskReddit"
SUBREDDIT=""
# Filters the comments by range of lenght (min and max characters)
# Min has to be less or equal to max
# DO NOT INSERT ANY SPACES BETWEEN THE COMMA AND THE VALUES
COMMENT_LENGTH_RANGE = "min,max"
# Range is 0 -> 1
OPACITY="0.9"
# The absolute path of the folder where you want to save the final video
# If empty or wrong, the path will be 'assets/'
FINAL_VIDEO_PATH=""

@ -6,12 +6,11 @@ All done WITHOUT video editing or asset compiling. Just pure ✨programming magi
Created by Lewis Menelaws & [TMRRW](https://tmrrwinc.ca)
[<picture>
[
<source media="(prefers-color-scheme: dark)" srcset="https://user-images.githubusercontent.com/6053155/170528535-e274dc0b-7972-4b27-af22-637f8c370133.png">
<source media="(prefers-color-scheme: light)" srcset="https://user-images.githubusercontent.com/6053155/170528582-cb6671e7-5a2f-4bd4-a048-0e6cfa54f0f7.png">
<img src="https://user-images.githubusercontent.com/6053155/170528582-cb6671e7-5a2f-4bd4-a048-0e6cfa54f0f7.png" width="350">
</picture>](https://tmrrwinc.ca)
](https://tmrrwinc.ca)
## Motivation 🤔

@ -1,6 +1,6 @@
#!/usr/bin/env python3
from numpy import Infinity
from rich.console import Console
from utils.console import print_step, print_substep
from utils.console import print_step, print_substep, print_markdown
from dotenv import load_dotenv
import os
import random
@ -81,14 +81,18 @@ def get_subreddit_threads():
content["comments"] = []
for top_level_comment in submission.comments:
if not top_level_comment.stickied:
content["comments"].append(
{
"comment_body": top_level_comment.body,
"comment_url": top_level_comment.permalink,
"comment_id": top_level_comment.id,
}
)
COMMENT_LENGTH_RANGE = [0, Infinity]
if os.getenv("COMMENT_LENGTH_RANGE"):
COMMENT_LENGTH_RANGE = [int(i) for i in os.getenv("COMMENT_LENGTH_RANGE").split(",")]
if COMMENT_LENGTH_RANGE[0] <= len(top_level_comment.body) <= COMMENT_LENGTH_RANGE[1]:
if not top_level_comment.stickied:
content["comments"].append(
{
"comment_body": top_level_comment.body,
"comment_url": top_level_comment.permalink,
"comment_id": top_level_comment.id,
}
)
except AttributeError:
pass

@ -9,7 +9,7 @@ from moviepy.editor import (
)
import reddit.subreddit
import re
from utils.console import print_step
from utils.console import print_step, print_substep
from dotenv import load_dotenv
import os
from rich.console import Console
@ -92,5 +92,15 @@ def make_final_video(number_of_clips):
final = CompositeVideoClip([background_clip, image_concat])
filename = (re.sub('[?\"%*:|<>]', '', ("assets/" + reddit.subreddit.submission.title + ".mp4")))
final.write_videofile(filename, fps=30, audio_codec="aac", audio_bitrate="192k")
final_video_path = "assets/"
if os.getenv("FINAL_VIDEO_PATH"):
final_video_path = os.getenv("FINAL_VIDEO_PATH")
filename = (re.sub('[?\"%*:|<>]', '', (final_video_path + reddit.subreddit.submission.title + ".mp4")))
try:
final.write_videofile(filename, fps=30, audio_codec="aac", audio_bitrate="192k")
except:
print_substep("Something's wrong with the path you inserted, the video will be saved in the default path (assets/)", style="bold red")
filename = (re.sub('[?\"%*:|<>]', '', ("assets/" + reddit.subreddit.submission.title + ".mp4")))
final.write_videofile(filename, fps=30, audio_codec="aac", audio_bitrate="192k")
for i in range(0, number_of_clips):
pass

@ -40,6 +40,7 @@ def download_screenshots_of_reddit_posts(reddit_object, screenshot_num, theme):
print_substep("Post is NSFW. You are spicy...")
page.locator('[data-testid="content-gate"] button').click()
page.locator('[data-click-id="text"] button').click() # Remove "Click to see nsfw" Button in Screenshot
page.locator('[data-test-id="post-content"]').screenshot(
path="assets/png/title.png"

Loading…
Cancel
Save