Soweit funktioniert alles.
Das Problem ist nun beim Abspielen von einem Radio Stream. Bei Werbung Ect kommt immer eine Fehlermeldung.
Leider habe ich das Problem mit meinen Begrenzten Python Fähigkeiten noch nicht im Griff bekommen.
Code: Alles auswählen
while True:
if mpc_status() == 0:
#os.system('/home/pi/scripts/mpd_display.py')
# Display Data
lcd_string(datetime.now().strftime('%m/%d/%Y %H:%M'),LCD_LINE_1,2)
lcd_string(ip_address(),LCD_LINE_2,2)
#lcd_string("CPU: "+measure_temp()+"c "+cpu_load()+"%",LCD_LINE_3,2)
#lcd_string(" ",LCD_LINE_3,1)
time.sleep(1)
elif mpc_status() == 1:
if (len(current_artist()) == 0):
sstring = os.popen('mpc -f %title%').readline()
astring = os.popen('mpc -f %title%').readline()
song = sstring.split('-')[1]
artist = astring.split('-')[0]
lcd_string(artist.strip(),LCD_LINE_1,2)
lcd_string(song.strip(),LCD_LINE_2,2)
lcd_string(song_elapsed()+" / Stream Time",LCD_LINE_4,3)
else:
lcd_string(current_artist(),LCD_LINE_1,1)
lcd_string(current_album(),LCD_LINE_2,1)
lcd_string(current_song(),LCD_LINE_3,1)
lcd_string(song_elapsed()+"/"+current_time(),LCD_LINE_4,3)
time.sleep(0.1)
Code: Alles auswählen
pi@raspberrypi:~/progs $ python display_mit_mpd.py
Traceback (most recent call last):
File "/home/pi/progs/display_mit_mpd.py", line 239, in <module>
main()
File "/home/pi/progs/display_mit_mpd.py", line 222, in main
song = sstring.split('-')[1]
IndexError: list index out of range