From 7989715c1d61f3f0701548ba132f75246317c25d Mon Sep 17 00:00:00 2001 From: Firepup Sixfifty Date: Mon, 6 May 2024 09:45:02 -0500 Subject: [PATCH] Don't reset the counter when the song changes --- config.py | 3 ++- threads.py | 17 +++++++++-------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/config.py b/config.py index 2bf334a..1658349 100644 --- a/config.py +++ b/config.py @@ -6,7 +6,7 @@ from typing import Optional, Any import bare, pylast load_dotenv() -__version__ = "v3.0.10" +__version__ = "v3.0.11-dev" 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, + "#hardfork": 0, }, "ignores": ["#fp-radio"], "admins": ["h-tl"], diff --git a/threads.py b/threads.py index d930b0c..c0cfbc2 100644 --- a/threads.py +++ b/threads.py @@ -87,21 +87,22 @@ def radio(instance: bare.bot) -> NoReturn: try: newTrack = instance.lastfmLink.get_user("Firepup650").get_now_playing() if newTrack: - complained = False - thisTrack = newTrack.__str__() - if thisTrack != lastTrack: + if complained: + complained = False misses = 0 missChunk = 0 - lastTrack = thisTrack - instance.msg("f.sp " + thisTrack, "#fp-radio") - instance.sendraw( - f"TOPIC #fp-radio :Firepup radio ({thisTrack}) - https://open.spotify.com/playlist/4ctNy3O0rOwhhXIKyLvUZM" - ) elif misses > missCap: missChunk += 1 if missChunk >= perChunk: misses -= 1 missChunk = 0 + thisTrack = newTrack.__str__() + if thisTrack != lastTrack: + lastTrack = thisTrack + instance.msg("f.sp " + thisTrack, "#fp-radio") + instance.sendraw( + f"TOPIC #fp-radio :Firepup radio ({thisTrack}) - https://open.spotify.com/playlist/4ctNy3O0rOwhhXIKyLvUZM" + ) elif not complained: if misses < 0: misses += 1