LibreELEC 8.90.007 - Tvheadend won't download XMLTV data

  • Since I upgraded to 8.90.007 from 8.2.5 (Generic), TVheadend hasn't been able to download guide data from my IPTV provider. It worked fine on 8.2.5.

    The URL (as it appears in settings.xml is

    Code
    http://my-provider.tv:2095/xmltv.php?amp;username=my-usernamee&password=my-password&type=m3u_plus&output=ts

    The addon adds the "amp" following each "&", when the settings are saved.

    In the log, I see

    Code
    2018-11-21 16:05:52.000 [   INFO] xmltv: /storage/.kodi/addons/service.tvheadend42/bin/tv_grab_file: grab /storage/.kodi/addons/service.tvheadend42/bin/tv_grab_file
    2018-11-21 16:05:52.002 [   INFO] spawn: Executing "/storage/.kodi/addons/service.tvheadend42/bin/tv_grab_file"
    2018-11-21 16:05:52.735 [   INFO] iptv: m3u parse: 0 new mux(es) in network 'IPTV Automatic Network' (total 78)
    2018-11-21 16:05:53.399 [  ERROR] spawn: wget: server returned error: HTTP/1.1 401 Unauthorized
    2018-11-21 16:05:53.400 [  ERROR] xmltv: /storage/.kodi/addons/service.tvheadend42/bin/tv_grab_file: no output detected
    2018-11-21 16:05:53.400 [WARNING] xmltv: /storage/.kodi/addons/service.tvheadend42/bin/tv_grab_file: grab returned no data

    The username and password are correct, since they were working before I upgraded, and the URL works when pasted into a browser.

    Is this a bug, or am I doing something wrong? Any help would be much appreciated.

    Edited 3 times, last by rkershenbaum (November 22, 2018 at 1:33 PM).

  • I won't rule out that the script might be broken, but I have sadly no url to something that I could test it at all.

    Is there a way I can privately send you the actual URL, with the username and password? I wouldn't mind doing that if it would help you diagnose the problem, and (of course) if you wouldn't share it.

  • After some investigation, I found the underlying problem. The tv_grab_file script doesn't "unescape" the URL from settings.xml before using it in the wget command to fetch the XMLTV listings. I.e. it doesn't change "&" to simply "&", so the URL doesn't properly pass the login credentials to the server.

    I changed the line:

    Code
    wget -qO - "$XMLTV_LOCATION_WEB"

    to:

    Code
    wget -qO - $(xml unesc $XMLTV_LOCATION_WEB)

    I'm not a Linux guru, so I don't know if this is the best way to fix the problem, or if it might break something for other users. But my listings are now downloading properly.