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

replace rt sequence

This commit is contained in:
2025-12-12 16:39:50 +01:00
parent 82c56f1cfe
commit b9a2ff3015

View File

@@ -55,16 +55,16 @@ def update_rds(track_name: str):
# title = re.sub(r'\s*[\(\[][^\(\)\[\]]*[\)\]]', '', title) # there might be junk # title = re.sub(r'\s*[\(\[][^\(\)\[\]]*[\)\]]', '', title) # there might be junk
prt = rds_base.format(artist, title) prt = rds_base.format(artist, title)[:64]
rtp = [4] # type 1 rtp = []
rtp.append(prt.find(artist)) # start 1
rtp.append(len(artist) - 1) # len 1
rtp.append(1) # type 2 rtp.append(1) # type 2
rtp.append(prt.find(title)) # start 2 rtp.append(prt.find(title)) # start 2
rtp.append(len(title) - 1) # len 2 rtp.append(len(title) - 1) # len 2
rtp.append(4) # type 1
rtp.append(prt.find(artist)) # start 1
rtp.append(len(artist) - 1) # len 1
for i,(i_rt,j_size) in enumerate(zip(rtp, [255,0x3f,0x3f,255,0x3f,0x1f])): rtp = [j_size if i_rt > j_size else i_rt for i_rt,j_size in zip(rtp, [255,0x3f,0x3f,255,0x3f,0x1f])]
if i_rt > j_size: rtp[i] = j_size
rtp = ','.join(list(map(str, rtp))) rtp = ','.join(list(map(str, rtp)))