TVHeadend 4.2 Add-On


  • Which bug?
    I have this addon and works well for me.

    Regards.

    LibreElec 8.0.1, RPi2.arm, installed on a RPi3.
    Only add-on is TVHeadend 4.2

    When configuring the addon for the location of the xmltv.xml file, if you choose "Web" and then put in a URL that contains multiple PHP parameters with a "&" the URL gets parsed into the settings.xml file incorrectly.

    The settings.xml file then will have:

    Code
    http://phpDomainName.com:port/getxml.php/username=myusername&password=mypassword

    Turn on debugging with URL and then look at the debug.txt file in .kodi/userdata/addon_data/service.module.TVHeadEnd42/
    Now force a run of the grabber from TVH
    This results in a "error:Spawn: <ip address:port>

    I then edited the settings.xml file with the proper URL on the line starting with:

    Code
    <setting id="XMLTV_LOCATION_WEB" value=">


    I removed the "AMP;" and it fixes the first issue, but a second problem occurs:

    --------------------------------------------------------------------------------------------------------
    Now the wget request starts and data transmits, but it abruptly stops towards the end and the dbug.txt file for TVH4.2 shows:

    Code
    2017-03-29 10:56:37.495 spawn: - 100% |*******************************| 4211k 0:00:00 ETA2017-03-29 10:56:37.705 xmltv: /storage/.kodi/addons/service.tvheadend42/bin/tv_grab_file: htsmsg_xml_deserialize error Unexpected end of file during parsing of label reference2017-03-29 10:56:37.705 xmltv: /storage/.kodi/addons/service.tvheadend42/bin/tv_grab_file: grab returned no data

    This second problem is related to the wget request found in the grab file: /storage/.kodi/addons/service.tvheadend42/bin/tv_grab_file

    Code
    elif [ "$XMLTV_TYPE" = "WEB" ]; then
        wget -qO - "$XMLTV_LOCATION_WEB"
        echo $XMLTV_LOCATION_WEB
        exit 0
      fi

    I believe the problem is that the file is streamed and not static. The current code tries to stream the file with -stdout and it can't handle the fact the the incoming file is also streamed. This seems to cause a buffering issue. I ran into a similar issue before and it was resolved with:

    Code
    wget --output-document=/location/of/saved/file/xmltv.xml "http://url to php service wrapped in quotes"

    So I believe a solution would be to modify the tv_grab_file with a similar wget statement to save the file statically and overwrite any old one. Then the file can get streamed into TVH.

    Unfortunately this is where my current Python knowledge ends. Sorry so long, but I dug into this a lot and wanted to document as much as possible to make it easier to fix.
    A temp solution is for users to create a cron job with the wget example I suggested. Then use the "FILE" option instead of "WEB" option when configuring the add-on.

    Edited once, last by mudrunner88 (March 29, 2017 at 4:29 PM).