From a0893dd4b273d270805c962caef58efde284cfdd Mon Sep 17 00:00:00 2001 From: Firepup Sixfifty Date: Thu, 9 May 2024 20:01:05 -0500 Subject: [PATCH] Radio debugging on homeserver --- config.py | 3 ++- threads.py | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/config.py b/config.py index 1658349..4ca70f7 100644 --- a/config.py +++ b/config.py @@ -6,7 +6,7 @@ from typing import Optional, Any import bare, pylast load_dotenv() -__version__ = "v3.0.11-dev" +__version__ = "v3.0.11" npbase: str = ( "\[\x0303last\.fm\x03\] [A-Za-z0-9_[\]{}\\|\-^]{1,$MAX} (is listening|last listened) to: \x02.+ - .*\x02( \([0-9]+ plays\)( \[.*\])?)?" # pyright: ignore [reportInvalidStringEscapeSequence] ) @@ -38,6 +38,7 @@ servers: dict[str, dict[str, Any]] = { "#sshchat": 0, "#firemc": 0, "#fp-radio": 0, + "#fp-radio-debug": 0, "#hardfork": 0, }, "ignores": ["#fp-radio"], diff --git a/threads.py b/threads.py index 46b216c..bb0ae82 100644 --- a/threads.py +++ b/threads.py @@ -83,6 +83,7 @@ def radio(instance: bare.bot) -> NoReturn: missChunk = 0 missCap = -5 perChunk = 10 + debug = instance.server == "replirc" while 1: try: newTrack = instance.lastfmLink.get_user("Firepup650").get_now_playing() @@ -107,6 +108,9 @@ def radio(instance: bare.bot) -> NoReturn: missChunk = 0 if misses < 0: misses += 1 + if debug: + instance.msg(str({"misses": misses, "missChunk": missChunk, "misses exceed or meet limit": misses <= missCap}), "#fp-radio-debug") + sleep(2) continue instance.msg( "Firepup seems to have stopped the music by mistake :/", "#fp-radio" @@ -120,6 +124,8 @@ def radio(instance: bare.bot) -> NoReturn: Err = format_exc() for line in Err.split("\n"): instance.log(line, "WARN") + if debug: + instance.msg(str({"misses": misses, "missChunk": missChunk, "misses exceed or meet limit": misses <= missCap}), "#fp-radio-debug") sleep(2) instance.log("Thread while loop broken", "FATAL") exit(1)