Project

General

Profile

Import from M3U - Underscore converted to HTML char "%5F"

Added by Marco Dalli over 3 years ago

Hello community,
I'm new to TVH and I'm trying to set ip up to connect to my Octopus NET SAT>IP server.
Granted that I cannot use the internal CI natively with the TV Adapters, I switched to generating a M3U playlist that I can save to a shared folder and import through "IPTV Automatic Network".
So far, so good, except that the URLs generated by the server (which I cannot modify) contain underscore characters that are somehow converted to HTML code "%5F" when imported to muxes.
For instance, the URL

?src=1&freq=11432&pol=v&sr=29900&msys=dvbs2&pids=0,220,1490,1492,1491,0&x_pmt=220&x_ci=1

becomes
?src=1&freq=11432&pol=v&sr=29900&msys=dvbs2&pids=0,220,1490,1492,1491,0&x%5Fpmt=220&x%5Fci=1

Is there a way to avoid this, rather than manually edit them (which would break auto update funtion)? Some sort of escape character maybe that I can manually add to the M3U?


Replies (14)

RE: Import from M3U - Underscore converted to HTML char "%5F" - Added by Michael Rossol about 3 years ago

Hello together, i would like to push up this question, because I have the same problem. I also haven't found a solution to avoid it.

Thanks.

RE: Import from M3U - Underscore converted to HTML char "%5F" - Added by saen acro about 3 years ago

add issue on that
"Ci support for Octopus NET SAT>IP server"

RE: Import from M3U - Underscore converted to HTML char "%5F" - Added by Michael Rossol about 3 years ago

saen acro wrote:

"Ci support for Octopus NET SAT>IP server"

Hello Saen acro,
thanks for quick response, but I do not understand your comment. I haven't found "Ci support for Octopus NET SAT>IP server" in Tickets or forum. Can you give us some more details?

Thanks Michael

RE: Import from M3U - Underscore converted to HTML char "%5F" - Added by saen acro about 3 years ago

Create new Issue for that reason.
Hope some developer with some free time will write some code with will solve problem.

RE: Import from M3U - Underscore converted to HTML char "%5F" - Added by Michael Rossol about 3 years ago

saen acro wrote:

Create new Issue for that reason.
Hope some developer with some free time will write some code with will solve problem.

Ok, I will open a new ticket for this issue.

Thanks for your support.

Michael

RE: Import from M3U - Underscore converted to HTML char "%5F" - Added by saen acro about 3 years ago

Michael Rossol wrote:

Ticket is created: https://tvheadend.org/issues/6081

Question: Where is logic to make ticket for playlist, when need CI support in SAT>IP client.

RE: Import from M3U - Underscore converted to HTML char "%5F" - Added by Michael Rossol about 3 years ago

saen acro wrote:

Michael Rossol wrote:

Ticket is created: https://tvheadend.org/issues/6081

Question: Where is logic to make ticket for playlist, when need CI support in SAT>IP client.

According to subject the main problem is the converting of characters during import of playlist in this article.

Be that as it may, the bug is about the import of playlist.

RE: Import from M3U - Underscore converted to HTML char "%5F" - Added by port boy about 2 years ago

I have the same issue.
Is there an option or a way to change the mux urls in a chain?
I have more than 200 entries in my playlist and change over the admin ui wont be an option.

RE: Import from M3U - Underscore converted to HTML char "%5F" - Added by saen acro about 2 years ago

port boy wrote:

I have the same issue.
Is there an option or a way to change the mux urls in a chain?
I have more than 200 entries in my playlist and change over the admin ui wont be an option.

Edit it before import

RE: Import from M3U - Underscore converted to HTML char "%5F" - Added by port boy about 2 years ago

Wrong way, the entries in the playlist are korrekt :)
The %5F will be added during the import.
Or is there an option for escaping or change the import of the playlist?

RE: Import from M3U - Underscore converted to HTML char "%5F" - Added by port boy about 2 years ago

Alternatively maybe there is an option to change the url of every IPTV mux in chain. To replace the "%5F" with an "_" for every mux.
To do this manual through the admin interface is not a solution (for the hundreds of entries....)

RE: Import from M3U - Underscore converted to HTML char "%5F" - Added by Michael Rossol about 2 years ago

I have used TVH API for correcting the urls with a python script:
- exporting list with urls
- correcting url
- importing back to TVH

Here the main code:

# connect server
session = Session()
session.auth = HTTPBasicAuth("xxx", "xxx")

# reading streamlist
response = session.get(f"http://xxxx:9981/api/raw/export?class=iptv_mux", verify=False)
j = json.loads(response.text)
print("Server response during reading list:",response.status_code)

# changing streamlink and write back to server
for i in j:
    if "iptv_sname" in i.keys():
        i["iptv_url"]=i["iptv_url"].replace("%5F","_")
        i["iptv_url_cmpid"]=i["iptv_url_cmpid"].replace("%5F","_")
        #headers = {'Content-type': 'application/json', 'Accept': 'text/plain'}
        r2 = session.post(f"http://xxxxx:9981/api/raw/import?uuid={i['uuid']}",data={"node":json.dumps(i)})

        # print result
        print(i["iptv_sname"],"responsecode from server: ",r2.status_code)

Maybe this is helpful...

RE: Import from M3U - Underscore converted to HTML char "%5F" - Added by port boy about 2 years ago

Many thanks!!!!!!!!!!!
This is the solution for my issue :)
Ok, I had to make a short python udemy course to understand the script, but after this I was able to handle it. And now TVH works with my iptv playlist.

    (1-14/14)