tellytv / telly

An IPTV proxy
MIT License
774 stars 107 forks source link

expected element type <tv> but have <xml> #292

Open ActivateDZA opened 1 year ago

ActivateDZA commented 1 year ago

telly release with the issue:

version=1.1.0.6, branch=dev, revision=741108cd2100cf9f4d3a13f771d1ebe5132baae6

Last working telly release (if known): N/A

Operating environment (Docker/Windows/Linux/QNAP, etc.): Docker on Linux Ubuntu 22.04

Description of problem: I am trying to use telly but I have an error message that says expected element type tv but have xml. I can use VLC player to run the file and play the tv channel but cannot get it to work on telly. Is there a way to change this or do I need to contact the vendor?

Contents of telly.config.toml [if you're using a version above 1.1]:

# THIS SECTION IS REQUIRED ########################################################################
[Discovery]                                    # most likely you won't need to change anything here
  Device-Auth = "telly123"                     # These settings are all related to how telly identifies
  Device-ID = 12345678                         # itself to Plex.
  Device-UUID = ""
  Device-Firmware-Name = "hdhomeruntc_atsc"
  Device-Firmware-Version = "20150826"
  Device-Friendly-Name = "telly"
  Device-Manufacturer = "Silicondust"
  Device-Model-Number = "HDTC-2US"
  SSDP = true

# Note on running multiple instances of telly
# There are three things that make up a "key" for a given Telly Virtual Tuner:
# Device-ID [required], Device-UUID [optional], and port [required]
# When you configure your additional telly instances, change:
# the Device-ID [above] AND
# the Device-UUID [above, if you're entering one] AND
# the port [below in the "Web" section]

# THIS SECTION IS REQUIRED ########################################################################
[IPTV]
  Streams = 1               # number of simultaneous streams that telly virtual tuner will provide
                            # This is often 1, but is set by your iptv provider
  Starting-Channel = 10000  # When telly assigns channel numbers it will start here
  XMLTV-Channels = true     # if true, any channel numbers specified in your M3U file will be used.
# FFMpeg = true             # if this is uncommented, streams are buffered through ffmpeg; 
                            # ffmpeg must be installed and on your $PATH
                            # if you want to use this with Docker, be sure you use the correct docker image
# if you DO NOT WANT TO USE FFMPEG leave this commented; DO NOT SET IT TO FALSE [Issue #185]

# THIS SECTION IS REQUIRED ########################################################################
[Log]
  Level = "info"            # Only log messages at or above the given level. [debug, info, warn, error, fatal]
  Requests = true           # Log HTTP requests made to telly

# THIS SECTION IS REQUIRED ########################################################################
[Web]
  Base-Address = "192.168.1.12:6077"   # Set this to the IP address of the machine telly runs on AS SEEN BY PLEX
                                  # telly will be telling Plex to connect to URLs at this address.
                                  # DO NOT REMOVE THE PORT
                                  # Just change the 0.0.0.0 to your IP address.
  Listen-Address = "0.0.0.0:6077" # this can stay as-is

# THIS SECTION IS OPTIONAL ========================================================================
#[SchedulesDirect]           # If you have a Schedules Direct account, fill in details and then
                             # UNCOMMENT THIS SECTION
#  Username = ""             # This is under construction; There is no provider
#  Password = ""             # that works with it fully at this time

# AT LEAST ONE SOURCE IS REQUIRED #################################################################
# COPY/PASTE THIS BLOCK TO ADD MORE SOURCES #######################################################
# THIS EXAMPLE WILL NOT WORK AS-IS ################################################################
[[Source]]
  Name = ""                 # Name is optional and is used mostly for logging purposes
  Provider = "Custom"       # DO NOT CHANGE THIS
                            # "Custom" is telly's internal identifier for this 'Provider'
                            # If you change it to "SOMETHING ELSE", telly's reaction will be
                            # "I don't recognize a provider called 'SOMETHING ELSE'."
  M3U = "http://live24.co.za/play/list?username=REDACTED&password=REDACTED&type=m3u_plus&output=m3u8"  # This can be either URL or fully-qualified path.
                            # This needs to be an M3Uplus file
                            # IT CANNOT BE A STREAM ADDRESS
                            # IT CANNOT BE AN M3U THAT LINKS TO ANOTHER M3U
  EPG = "http://proxiednetwork.xyz/xmltv.php?username=REDACTED&password=REDACTED"       # This can be either URL or fully-qualified path.
  # THE FOLLOWING KEYS ARE OPTIONAL IN THEORY, REQUIRED IN PRACTICE
  Filter = "YOUR_FILTER_REGULAR_EXPRESSION"
                            # Telly is written in Go, and uses the Go regular expression system, 
                            # which is limited compared to other regular expression parsers.
  FilterKey = "group-title" # Telly applies the regular expression to the contents of this key in the M3U.
  FilterRaw = false         # FilterRaw will run your regex on the entire line instead of just specific keys.
  Sort = "group-title"      # Sort will alphabetically sort your channels by the M3U key provided
# END TELLY CONFIG  ###############################################################################

Docker run command used to run telly [if applicable]: docker compose up -d telly

telly or docker log:

time="2023-03-17T08:31:36Z" level=info msg="Loading M3U from http://live24.co.za/play/list?username=REDACTED&password=REDACTED&type=m3u_plus&output=m3u8"
time="2023-03-17T08:31:39Z" level=info msg="Loading XMLTV from http://proxiednetwork.xyz/xmltv.php?username=REDACTED&password=REDACTED"
time="2023-03-17T08:31:39Z" level=error msg="Could not decode xmltv programme" error="expected element type <tv> but have <xml>"
time="2023-03-17T08:31:39Z" level=error msg="error when parsing EPG" error="expected element type <tv> but have <xml>"
time="2023-03-17T08:31:39Z" level=error msg="error when preparing provider" error="expected element type <tv> but have <xml>"
time="2023-03-17T08:31:39Z" level=error msg="error when processing provider" error="expected element type <tv> but have <xml>"
time="2023-03-17T08:31:39Z" level=info msg="telly is live and on the air!"
time="2023-03-17T08:31:39Z" level=info msg="Broadcasting from http://0.0.0.0:6077/"
time="2023-03-17T08:31:39Z" level=info msg="EPG URL: http://0.0.0.0:6077/epg.xml"

Additional information:

chazlarson commented 1 year ago

This is going to filter everything out and leave you with no channels:

  Filter = "YOUR_FILTER_REGULAR_EXPRESSION"

The error seems like the EPG XML is malformed; it's expected to look like:

<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE tv SYSTEM "xmltv.dtd">
<tv generator-info-name="S" generator-info-url="http://REDACTED/">
    <channel id="cookingchannel.us">
        <display-name>COOKING CHANNEL</display-name>
        <icon src="http://REDACTED/logos/Cooking(1).png" />
    </channel>
...

It appears that yours doesn't contain that tv element

ActivateDZA commented 1 year ago

This is going to filter everything out and leave you with no channels:

  Filter = "YOUR_FILTER_REGULAR_EXPRESSION"

The error seems like the EPG XML is malformed; it's expected to look like:

<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE tv SYSTEM "xmltv.dtd">
<tv generator-info-name="S" generator-info-url="http://REDACTED/">
  <channel id="cookingchannel.us">
      <display-name>COOKING CHANNEL</display-name>
      <icon src="http://REDACTED/logos/Cooking(1).png" />
  </channel>
...

It appears that yours doesn't contain that tv element

Hi chazlarson I have created a filter but it was still doing the same thing

The EPG XML file that I got contains the following:

<xml generator-info-name="IPTV" generator-info-url="REDACTED.xyz">
<channel id="bbc1.uk">
<display-name>UK: BBC ONE FHD</display-name>
<icon src="https://REDACTED"/>
</channel>
<channel id="bbc1.uk">
<display-name>UK: BBC ONE FHD (H265)</display-name>
<icon src="https://REDATED"/>
</channel>

I have contacted the supplier but I am sure they will say that is how they do it. Is there no way that telly can accept xml? VLC works just fine with this EPG XML file.

chazlarson commented 1 year ago

Hi chazlarson I have created a filter but it was still doing the same thing

All I know is what's presented here.

Is there no way that telly can accept xml? VLC works just fine with this EPG XML file.

Telly does accept XML; it just expects that XML to be structured in a particular way. In your example, it seems that what telly is looking for as the tv element has been renamed to xml, where the expected format has an xml element wrapping the tv element.

Of course telly could be modified to accept whatever; it's only typing. However, the existing code works with EPG XML from every IPTV provider tested over the years along with independent XML providers.

I'd accept a PR that made this change, but probably won't put any time into addressing it myself.

ActivateDZA commented 1 year ago

Thank you for the answer @chazlarson can you point in the right direction to dev the change?

I suspect its within this code? https://github.com/tellytv/telly/blob/dev/internal/xmltv/xmltv.go

chazlarson commented 1 year ago

Yep; you can see in that directory the format example from the source; it appears that what you have there is not conforming to the standard:

http://wiki.xmltv.org/index.php/XMLTVFormat