Open Beun opened 6 years ago
It looks like this line is the issue.
nowplaying = requests.get('http://example.com/data.txt').content
It may be because it is trying to send it before it has fully downloaded the file. I would make that into a function that you call when you are sending RDS.
Lewis
On Thu, May 17, 2018 at 5:01 AM, Beun notifications@github.com wrote:
Hello,
I realise the code I'm asking about is three years old already, but I still hope you can help me.
Something seems to go wrong if I try to enter a value from a string into radio.setRDSbuffer, in radio.py.
This DOES work as expected:
while True: radio.setRDSbuffer( "My own") sleep(6) radio.setRDSbuffer( "Radiostation") sleep(6)
And this does NOT work as expected. RDS stops after the sleep(6) after radio.setRDSbuffer( "Radiostation"):
import requests while True: radio.setRDSbuffer( "My own") sleep(6) radio.setRDSbuffer( "Radiostation") sleep(6) nowplaying = requests.get('http://example.com/data.txt').content radio.setRDSbuffer(nowplaying) sleep(15)
This is the error message that gets displayed in the terminal:
Traceback (most recent call last): File "/home/pi/Internet-Radio-Rebroadcaster/radio.py", line 41, in
radio.setRDSbuffer(nowplaying) File "/home/pi/Internet-Radio-Rebroadcaster/Adafruit_Si4713.py", line 749, in setRDSbuffer bufferArray[i] = char IndexError: list assignment index out of range For the record; opening http://example.com/data.txt in a browser shows the one line of plain text as expected. Also, the below code prints out the contents of the text file to the terminal perfectly. So the retrieving of the text and putting it into a string, and then printing that string works.
import requests nowplaying = requests.get('http://example.com/data.txt').content print (nowplaying)
Any idea on how to get a string value into radio.setRDSbuffer, in radio.py?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/electrodog10/Internet-Radio-Rebroadcaster/issues/1, or mute the thread https://github.com/notifications/unsubscribe-auth/AEYMalhiMtgRHbiU1JyNMg4aOCsewWDtks5tzUpdgaJpZM4UCxIR .
-- Lewis Callaway 641-529-6520
Hello,
I realise the code I'm asking about is three years old already, but I still hope you can help me.
Something seems to go wrong if I try to enter a value from a string into radio.setRDSbuffer, in radio.py.
This DOES work as expected:
And this does NOT work as expected. RDS stops after the sleep(6) after radio.setRDSbuffer( "Radiostation"):
This is the error message that gets displayed in the terminal:
For the record; opening http://example.com/data.txt in a browser shows the one line of plain text as expected. Also, the below code prints out the contents of the text file to the terminal perfectly. So the retrieving of the text and putting it into a string, and then printing that string works.
Any idea on how to get a string value into radio.setRDSbuffer, in radio.py?