0
1
mirror of https://github.com/radio95-rnt/RadioPlayer.git synced 2026-02-26 21:53:54 +01:00

add timeout

This commit is contained in:
2025-07-12 18:15:02 +02:00
parent 94784785a9
commit 55642a51b6

View File

@@ -47,7 +47,12 @@ def update_rds(track_name):
prt = rds_base.format(rds_default_name)
f = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
f.sendto(f"TEXT={prt}\r\n".encode(), ("127.0.0.1", 5000))
f.settimeout(1.0)
try:
f.sendto(f"TEXT={prt}\r\n".encode(), ("127.0.0.1", 5000))
except socket.timeout:
print("Could not send to RDS, timeout.")
return
try:
f.sendto(f"RTP={rds_default_rtp_data},{len(str(name_table[track_name]))-1}\r\n".encode(), ("127.0.0.1", 5000))