0

I have the following working code to stream audio from a webradio station: (Raspberry Pi Pico on a Pimoroni Pico Demo Base. CircuitPython 9.2.1)

import time, os
import adafruit_connection_manager
import adafruit_requests
import audiobusio
import audiomp3
import board
import wifi


ssid = os.getenv("CIRCUITPY_WIFI_SSID")
password = os.getenv("CIRCUITPY_WIFI_PASSWORD")

mp3_buffer = bytearray(16384)
mp3_decoder = audiomp3.MP3Decoder("slow.mp3", mp3_buffer)

pool = adafruit_connection_manager.get_radio_socketpool(wifi.radio)
ssl_context = adafruit_connection_manager.get_radio_ssl_context(wifi.radio)
requests = adafruit_requests.Session(pool, ssl_context)

STREAMING_URL = "http://www.radioeins.de/livemp3_s"

i2s = audiobusio.I2SOut(bit_clock = board.GP27, word_select = board.GP28, data = board.GP26)


try:
    # Connect to the Wi-Fi network
    wifi.radio.connect(ssid, password)
except OSError as e:
    print(f"OSError: {e}")


with requests.get(STREAMING_URL, headers = {"connection": "close"}, stream = True) as response:
    mp3_decoder.file = response.socket
    i2s.play(mp3_decoder)
    while i2s.playing:
        time.sleep(0.1)

Now I would like to get the meta data from that stream but couldn't find a solution online. Can anyone please help me with this? I know how to use json decode but in this case it's not a json file but just meta data.

Thank's Martin

1
  • Did you get this to work? I started looking doing the same thing Commented Apr 17 at 13:42

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.