From 6954441da3726c5797c57570807d0d263ae25d26 Mon Sep 17 00:00:00 2001 From: Arthur Date: Sun, 5 Sep 2021 12:14:18 -0400 Subject: [PATCH] Ignore Ads --- monitoringBackend/spotify.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/monitoringBackend/spotify.py b/monitoringBackend/spotify.py index 14f242c..4779922 100644 --- a/monitoringBackend/spotify.py +++ b/monitoringBackend/spotify.py @@ -258,6 +258,7 @@ def historySpotify(user): time.sleep(1200) except: log.exception("Song Lookup Failure: " + str(user)) + log.warning(str(response)) update_status(user, "statusSong", 1) time.sleep(60) status = database.user_status(user) @@ -298,16 +299,21 @@ def realTimeSpotify(user): update_status(user, "statusSong", 1) time.sleep(60) elif(response.json().get("is_playing") and - "unknown" in str.lower(response.json().get("currently_playing_type", "false"))): - log.warning("Unknown Error: " + - str(user) + " : " + str(response)) + "ad" in str.lower(response.json().get("currently_playing_type", "false"))): + log.debug("Ignoring Adt: " + str(user)) update_status(user, "statusSong", 1) - time.sleep(45) + time.sleep(30) elif(response.json().get("is_playing") and "episode" in str.lower(response.json().get("currently_playing_type", "false"))): log.debug("Ignoring Podcast: " + str(user)) update_status(user, "statusSong", 1) time.sleep(90) + elif(response.json().get("is_playing") and + "unknown" in str.lower(response.json().get("currently_playing_type", "false"))): + log.warning("Unknown Error: " + + str(user) + " : " + str(response.json())) + update_status(user, "statusSong", 1) + time.sleep(45) else: response = response.json() if(response.get("is_playing")):