Don't reset the counter when the song changes
This commit is contained in:
parent
eaa1f14bf9
commit
7989715c1d
2 changed files with 11 additions and 9 deletions
|
@ -6,7 +6,7 @@ from typing import Optional, Any
|
||||||
import bare, pylast
|
import bare, pylast
|
||||||
|
|
||||||
load_dotenv()
|
load_dotenv()
|
||||||
__version__ = "v3.0.10"
|
__version__ = "v3.0.11-dev"
|
||||||
npbase: str = (
|
npbase: str = (
|
||||||
"\[\x0303last\.fm\x03\] [A-Za-z0-9_[\]{}\\|\-^]{1,$MAX} (is listening|last listened) to: \x02.+ - .*\x02( \([0-9]+ plays\)( \[.*\])?)?" # pyright: ignore [reportInvalidStringEscapeSequence]
|
"\[\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,
|
"#sshchat": 0,
|
||||||
"#firemc": 0,
|
"#firemc": 0,
|
||||||
"#fp-radio": 0,
|
"#fp-radio": 0,
|
||||||
|
"#hardfork": 0,
|
||||||
},
|
},
|
||||||
"ignores": ["#fp-radio"],
|
"ignores": ["#fp-radio"],
|
||||||
"admins": ["h-tl"],
|
"admins": ["h-tl"],
|
||||||
|
|
17
threads.py
17
threads.py
|
@ -87,21 +87,22 @@ def radio(instance: bare.bot) -> NoReturn:
|
||||||
try:
|
try:
|
||||||
newTrack = instance.lastfmLink.get_user("Firepup650").get_now_playing()
|
newTrack = instance.lastfmLink.get_user("Firepup650").get_now_playing()
|
||||||
if newTrack:
|
if newTrack:
|
||||||
complained = False
|
if complained:
|
||||||
thisTrack = newTrack.__str__()
|
complained = False
|
||||||
if thisTrack != lastTrack:
|
|
||||||
misses = 0
|
misses = 0
|
||||||
missChunk = 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:
|
elif misses > missCap:
|
||||||
missChunk += 1
|
missChunk += 1
|
||||||
if missChunk >= perChunk:
|
if missChunk >= perChunk:
|
||||||
misses -= 1
|
misses -= 1
|
||||||
missChunk = 0
|
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:
|
elif not complained:
|
||||||
if misses < 0:
|
if misses < 0:
|
||||||
misses += 1
|
misses += 1
|
||||||
|
|
Loading…
Reference in a new issue