From af78ec5085364956d34db182ce72e2f92884665e Mon Sep 17 00:00:00 2001 From: Pinapelz Date: Thu, 17 Apr 2025 12:41:22 -0700 Subject: fix: nostop typo --- rasis.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'rasis.py') diff --git a/rasis.py b/rasis.py index 89288df..ea253ff 100644 --- a/rasis.py +++ b/rasis.py @@ -67,7 +67,7 @@ def generate_post_content(post_data: dict) -> str: elif "GITADORA " in post_data["identifier"]: game = "GITADORA" tags = "#gitadora #bemani" - elif "NOLSTALGIA" in post_data["identifier"]: + elif "NOSTALGIA" in post_data["identifier"]: game = "NOSTALGIA" tags = "#bemani" elif "CHUNITHM_JP" in post_data["identifier"]: -- cgit v1.2.3 From 1d488dcb140affb7d14b5f936a98bbf0349ee2ad Mon Sep 17 00:00:00 2001 From: Pinapelz Date: Thu, 17 Apr 2025 15:42:45 -0700 Subject: truncate post content if its longer than 3000 chars --- rasis.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'rasis.py') diff --git a/rasis.py b/rasis.py index ea253ff..c5bcba4 100644 --- a/rasis.py +++ b/rasis.py @@ -95,7 +95,11 @@ def generate_post_content(post_data: dict) -> str: content = content + f"[{post_data['type']}] " if post_data["headline"] is not None and post_data["headline"] != post_data["content"] : content = content + f"[{post_data['headline']}]\n\n" - content = content + post_data["content"] + "\n\n" + if len(post_data["content"]) > 3000: + truncated_content = post_data["content"][:3000] + "..." + content = content + truncated_content + "\n\n" + else: + content = content + post_data["content"] + "\n\n" if post_data["url"] is not None: content = content + f"🔗 {post_data['url']}\n" for i in range(len(post_data["images"])): -- cgit v1.2.3 From ccddc4541c69dff0445edbcc56b07a7835c4e2de Mon Sep 17 00:00:00 2001 From: Pinapelz Date: Thu, 17 Apr 2025 18:36:06 -0700 Subject: skip posts if the identifier is unknown --- rasis.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'rasis.py') diff --git a/rasis.py b/rasis.py index c5bcba4..ad206f7 100644 --- a/rasis.py +++ b/rasis.py @@ -90,6 +90,8 @@ def generate_post_content(post_data: dict) -> str: post_data['headline'] = None game = "O.N.G.E.K.I (JPN)" tags = "#ongeki" + else: + return None content = f"📰 {game} - {post_data['date']}\n\n" if post_data["type"] is not None: content = content + f"[{post_data['type']}] " @@ -132,5 +134,7 @@ if __name__ == "__main__": queued_posts = generate_queued_posts() for post in queued_posts: content = generate_post_content(post) + if content is None: + continue cleaned = content.encode("utf-8", "replace").decode("utf-8") post_on_fedi(cleaned) -- cgit v1.2.3