From ad13e5d69f189debb71fac10e385b566f8f41e4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Abdulkadir=20Furkan=20=C5=9Eanl=C4=B1?= Date: Tue, 23 Jan 2024 18:53:53 +0100 Subject: [PATCH] Add entertainment category and fix incorrect variable name. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Abdulkadir Furkan Şanlı --- main.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/main.py b/main.py index b149dab..321871b 100755 --- a/main.py +++ b/main.py @@ -177,7 +177,10 @@ def is_music(youtube, video_id): video_details = youtube.videos().list(id=video_id, part="snippet").execute() # Check if the video category is Music (typically category ID 10) - return video_details["items"][0]["snippet"]["categoryId"] == "10" + return video_details["items"][0]["snippet"]["categoryId"] in ( + "10", + "24", + ) # music, entertainment async def message_callback(client, room, event): @@ -211,7 +214,7 @@ async def message_callback(client, room, event): message_type="m.room.message", content={"msgtype": "m.text", "body": intro_message}, ) - with open("./parker.gif", "rb") as gif_file: # this is broken as shit + with open("./parker.gif", "rb") as gif_file: # this is broken as shit response = await client.upload(gif_file, content_type="image/gif") if isinstance(response, UploadResponse): print("Image was uploaded successfully to server. ") @@ -227,8 +230,7 @@ async def message_callback(client, room, event): }, ) else: - print(f"Failed to upload image. Failure response: {resp}") - + print(f"Failed to upload image. Failure response: {response}") if body == "!pow" and current_time - timestamp_sec < datetime.timedelta( seconds=30