Radio debugging on homeserver
This commit is contained in:
parent
df71efc4c9
commit
a0893dd4b2
2 changed files with 8 additions and 1 deletions
|
@ -6,7 +6,7 @@ from typing import Optional, Any
|
||||||
import bare, pylast
|
import bare, pylast
|
||||||
|
|
||||||
load_dotenv()
|
load_dotenv()
|
||||||
__version__ = "v3.0.11-dev"
|
__version__ = "v3.0.11"
|
||||||
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,
|
||||||
|
"#fp-radio-debug": 0,
|
||||||
"#hardfork": 0,
|
"#hardfork": 0,
|
||||||
},
|
},
|
||||||
"ignores": ["#fp-radio"],
|
"ignores": ["#fp-radio"],
|
||||||
|
|
|
@ -83,6 +83,7 @@ def radio(instance: bare.bot) -> NoReturn:
|
||||||
missChunk = 0
|
missChunk = 0
|
||||||
missCap = -5
|
missCap = -5
|
||||||
perChunk = 10
|
perChunk = 10
|
||||||
|
debug = instance.server == "replirc"
|
||||||
while 1:
|
while 1:
|
||||||
try:
|
try:
|
||||||
newTrack = instance.lastfmLink.get_user("Firepup650").get_now_playing()
|
newTrack = instance.lastfmLink.get_user("Firepup650").get_now_playing()
|
||||||
|
@ -107,6 +108,9 @@ def radio(instance: bare.bot) -> NoReturn:
|
||||||
missChunk = 0
|
missChunk = 0
|
||||||
if misses < 0:
|
if misses < 0:
|
||||||
misses += 1
|
misses += 1
|
||||||
|
if debug:
|
||||||
|
instance.msg(str({"misses": misses, "missChunk": missChunk, "misses exceed or meet limit": misses <= missCap}), "#fp-radio-debug")
|
||||||
|
sleep(2)
|
||||||
continue
|
continue
|
||||||
instance.msg(
|
instance.msg(
|
||||||
"Firepup seems to have stopped the music by mistake :/", "#fp-radio"
|
"Firepup seems to have stopped the music by mistake :/", "#fp-radio"
|
||||||
|
@ -120,6 +124,8 @@ def radio(instance: bare.bot) -> NoReturn:
|
||||||
Err = format_exc()
|
Err = format_exc()
|
||||||
for line in Err.split("\n"):
|
for line in Err.split("\n"):
|
||||||
instance.log(line, "WARN")
|
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)
|
sleep(2)
|
||||||
instance.log("Thread while loop broken", "FATAL")
|
instance.log("Thread while loop broken", "FATAL")
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
Loading…
Reference in a new issue