martinkirch / showergel

Showergel is made to live aside Liquidsoap: while a Liquidsoap script creates a radio stream, Showergel provides complementary features like logging or occasional scheduling, with a (minimalist) Web interface.
GNU General Public License v3.0
23 stars 3 forks source link

Decoding telnet commands from Liquidsoap 2.x #20

Closed martinkirch closed 2 years ago

martinkirch commented 3 years ago

Following https://github.com/savonet/liquidsoap/issues/1590

While testing GET /live with Liquidsoap 2 :

2021-04-22 21:46:18,841 DEBUG [worker 7][showergel.showergel_bottle:24] Caught:
Traceback (most recent call last):
  File "/home/martin/.local/lib/python3.7/site-packages/bottle/__init__.py", line 1002, in _handle
    out = route.call(**args)
  File "/home/martin/.local/lib/python3.7/site-packages/bottle/__init__.py", line 2018, in wrapper
    rv = callback(*a, **ka)
  File "/home/martin/.local/lib/python3.7/site-packages/showergel/rest/live.py", line 27, in get_live
    metadata = connection.current()
  File "/home/martin/.local/lib/python3.7/site-packages/showergel/liquidsoap_connector.py", line 153, in current
    raw = self._command("request.metadata " + current_rid)
  File "/home/martin/.local/lib/python3.7/site-packages/showergel/liquidsoap_connector.py", line 89, in _command
    line = self._connection.read_until(b'END').decode('utf8')
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xf4 in position 635: invalid continuation byte

in _command split lines before calling decode('utf8') on each ; ignore lines raising UnicodeDecodeError

martinkirch commented 2 years ago

Done in 23e77cac4981c0177acb39c72cc737143deb0aa4