Skip to content

Commit efaccc8

Browse files
committed
add rds
1 parent 5fd92c0 commit efaccc8

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Raspberry_Pi_PiPyPirate_Radio/radio.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#--| User Config |-----------------------------------
1313
FREQ = 89.00
1414
PLAYLIST = "test"
15+
STATION_NAME = "PiPyPirate Radio"
1516
UPDATE_RATE = 0.5
1617
#----------------------------------------------------
1718

@@ -56,6 +57,7 @@
5657
)
5758
radio.tx_frequency_khz = int(FREQ * 1000)
5859
radio.tx_power = 115
60+
radio.configure_rds(0xADAF, station=STATION_NAME.encode())
5961

6062
# MPD
6163
mpc = mpd.MPDClient()
@@ -103,6 +105,8 @@ def update_display():
103105
draw.text( (5, 150), artist, font=INFO_FNT, fill=ARTS_CLR )
104106
draw.text( (5, 170), album, font=INFO_FNT, fill=ALBM_CLR)
105107
draw.text( (5, 190), song, font=INFO_FNT, fill=TITL_CLR)
108+
rds_info = "{}:{}:{}".format(artist, album, song)
109+
radio.rds_buffer = rds_info.encode()
106110

107111
perc = float(status['elapsed']) / float(status['duration'])
108112
draw.rectangle( (5, 215, 235, 230), outline=PROG_CLR)
@@ -115,6 +119,8 @@ def update_display():
115119

116120
last_update = time.monotonic()
117121

122+
print("Now broadcasting {} on {}FM".format(STATION_NAME, FREQ))
123+
118124
while True:
119125
now = time.monotonic()
120126
try:

0 commit comments

Comments
 (0)