euzu/m3u-filter

Issue with particular channel not comming trhough

Closed this issue · 27 comments

I'm not 100% sure if what I'm experiencing is a bug or I made some mistake during configuration.

My config looks like this :

source.yml

sources:
- inputs:
    - name: pl1
      type: m3u
      persist: 'playlist_1_{}.m3u'
      url: 'http:provider.com/m3u'
      headers:
       User-Agent: "Mozilla/5.0 (Linux; Tizen 2.3) AppleWebKit/538.1 (KHTML, like Gecko)Version/2.3 TV Safari/538.1"
  targets:
   - name: livego
     options:
         ignore_logo: true
     output:
       - type: m3u
         filename: pl1.m3u
     sort:
          order: asc
     filter: '(Group ~ ".*Spain.*") OR (Group ~ ".*Belgium.*")'

mapping.yml

mappings:
  templates:
    - name: spain
      value: 'Group ~ ".*Spain.*"'
    - name: source
      value: 'Url ~ "https?:\/\/(.*?)\/(?P<query>.*)$"'
  mapping:
    - id: spain
      mapper:
        - filter: '!spain!'
          pattern: "!source!"

In the list of my provider I can clearly see these channels :

#EXTINF:-1 tvg-ID="axn.es" tvg-name="ES: AXN FHD" tvg-logo="[""]" group-title="Spain",ES: AXN FHD
http://url
#EXTINF:-1 tvg-ID="axn.es" tvg-name="ES: AXN HD" tvg-logo="[""]" group-title="Spain",ES: AXN HD
http://url
#EXTINF:-1 tvg-ID="axnwhite.es" tvg-name="ES: AXN White FHD" tvg-logo="[" group-title="Spain",ES: AXN White FHD
http://url
#EXTINF:-1 tvg-ID="axnwhite.es" tvg-name="ES: AXN WHITE HD" tvg-logo="" group-title="Spain",ES: AXN WHITE HD
http://url

However only the AXN White channels come through.
To me it looks like the regex pattern I'm using is correct and that something else is going on.
However if I messed up please tell me and I'll close the issue.

euzu commented

@davidclaeysquinones the Problem is your playlist. as you can see the first and second lines have an invalid entry -> tvg-logo="[""]" which causes the m3u-filter to take ES: AXN FD and EX: AXN HD as group.

This means, only the third and fourth lines have the group Spain.

Fixing this issue means to change the m3u playlist parsing of m3u-filter to allow invalid format.

I try to find a solution for this.

I didn't realize there was an error in my playlist file.
For now I'll add AXN as an addition group filter.
Thanks :)

euzu commented

@davidclaeysquinones when you can wait a little bit i am working on a fix.

euzu commented

@davidclaeysquinones i have pushed changes to the matser branch, you can build the binary and test it.

that was quite quick :)
I'm using docker so testing it out will be a bit cumbersome so I'll need some more time

euzu commented

@davidclaeysquinones the docker image does not have the latest changes which you can see in the CHANGELOG.md

euzu commented

@davidclaeysquinones i build a new relase, pull the latest docker image from github

I've build the Docker image locally.
Right now the channel that was lacking is not anymore.
However channels like HU: AXN Black are now also included.
I've checked twice to make sure my temporary fix is not included on my test environment.

So by example the following Axn channels exist in my playlist

#EXTINF:-1 tvg-ID="axn.rs" tvg-name="CRO: AXN Adria" tvg-logo="[" group-title="Hrvatska",CRO: AXN Adria
http://url
#EXTINF:-1 tvg-ID="axnspin.rs" tvg-name="CRO: AXN Spin" tvg-logo="[" group-title="Hrvatska",CRO: AXN Spin
http://url
#EXTINF:-1 tvg-ID="AXN.rs" tvg-name="RS: AXN" tvg-logo="" group-title="Srbija & MN",RS: AXN
http://url
#EXTINF:-1 tvg-ID="axnspin.rs" tvg-name="RS: AXN Spin" tvg-logo="" group-title="Srbija & MN",RS: AXN Spin
http://url
#EXTINF:-1 tvg-ID="axn.es" tvg-name="ES: AXN FHD" tvg-logo="[""]" group-title="Spain",ES: AXN FHD
http://url
#EXTINF:-1 tvg-ID="axn.es" tvg-name="ES: AXN HD" tvg-logo="[""]" group-title="Spain",ES: AXN HD
http://url
#EXTINF:-1 tvg-ID="axn.es" tvg-name="ES: Axn Spain" tvg-logo="[""]" group-title="Spain",ES: Axn Spain
http://url
#EXTINF:-1 tvg-ID="axnwhite.es" tvg-name="ES: AXN White FHD" tvg-logo="[" group-title="Spain",ES: AXN White FHD
http://url
#EXTINF:-1 tvg-ID="axnwhite.es" tvg-name="ES: AXN WHITE HD" tvg-logo="" group-title="Spain",ES: AXN WHITE HD
http://url
#EXTINF:-1 tvg-ID="axnwhite.es" tvg-name="ES: Axn White Spain" tvg-logo="[""]" group-title="Spain",ES: Axn White Spain
http://url
#EXTINF:-1 tvg-ID="axn.de" tvg-name="DE: AXN FHD" tvg-logo="[" group-title="Germany",DE: AXN FHD
http://url
#EXTINF:-1 tvg-ID="axn.de" tvg-name="DE: AXN HD" tvg-logo="[" group-title="Germany",DE: AXN HD
http://url
#EXTINF:-1 tvg-ID="NULL" tvg-name="PT: AXN FHD" tvg-logo="" group-title="Portugal",PT: AXN FHD
http://url
#EXTINF:-1 tvg-ID="axn.pt" tvg-name="PT: AXN HD" tvg-logo="[" group-title="Portugal",PT: AXN HD
http://url
#EXTINF:-1 tvg-ID="NULL" tvg-name="PT: AXN MOVIES FHD" tvg-logo="" group-title="Portugal",PT: AXN MOVIES FHD
http://url
#EXTINF:-1 tvg-ID="NULL" tvg-name="PT: AXN MOVIES HD" tvg-logo="" group-title="Portugal",PT: AXN MOVIES HD
http://url
#EXTINF:-1 tvg-ID="axnwhite.pt" tvg-name="PT: AXN WHITE FHD" tvg-logo="[" group-title="Portugal",PT: AXN WHITE FHD
http://url
#EXTINF:-1 tvg-ID="axnwhite.pt" tvg-name="PT: AXN WHITE HD" tvg-logo="[" group-title="Portugal",PT: AXN WHITE HD
http://url
#EXTINF:-1 tvg-ID="axn.pt" tvg-name="PT: AXN Movies FHD" tvg-logo="[" group-title="Portugal",PT: AXN Movies FHD
http://url
#EXTINF:-1 tvg-ID="axnblack.pt" tvg-name="PT: AXN Movies HD" tvg-logo="[" group-title="Portugal",PT: AXN Movies HD
http://url
#EXTINF:-1 tvg-ID="" tvg-name="SK: AXN" tvg-logo="" group-title="Slovakia",SK: AXN
http://url
#EXTINF:-1 tvg-ID="" tvg-name="SK: AXN Black" tvg-logo="" group-title="Slovakia",SK: AXN Black
http://url
#EXTINF:-1 tvg-ID="" tvg-name="SK: AXN White" tvg-logo="" group-title="Slovakia",SK: AXN White
http://url
#EXTINF:-1 tvg-ID="axnblack.pl" tvg-name="PL: AXN Black" tvg-logo="" group-title="Poland",PL: AXN Black
http://url
#EXTINF:-1 tvg-ID="AXN (HD).hu" tvg-name="HU: AXN" tvg-logo="" group-title="Hungary",HU: AXN
http://url
#EXTINF:-1 tvg-ID="AXN (HD).hu" tvg-name="HU: AXN Black" tvg-logo="[""]" group-title="Hungary",HU: AXN Black
http://url
#EXTINF:-1 tvg-ID="AXN (HD).hu" tvg-name="HU: AXN White" tvg-logo="[""]" group-title="Hungary",HU: AXN White
http://url
euzu commented

@davidclaeysquinones yes this is correct, because you use AXN as filter, you should use Group ~ "Spain" now with the latest docker image or master branch builds, or use for example Group ~ "^ES: AXN.*" as filter.

The filter that I used for my test setup is filter: '(Group ~ ".*Spain.*") OR (Group ~ ".*Belgium.*")'
The Axn channels in the Spain group were correctly parsed but the HU (Hungary) channels should not appear.
I suspected it has to do with incorrect formatting on my providers part, since it's only the HU channels appearing.

I've included the snippet above with all the Axn channels that exists so you could figure out wht's going on with the HU one.

euzu commented

@davidclaeysquinones i took the playlist you pasted here. And i got only the 6 channels from spain

source.yml

sources:
- inputs:
    - name: pl1
      type: m3u
      persist: 'playlist_1_{}.m3u'
      url: 'http://localhost:7000/quinones.m3u'
      headers:
       User-Agent: "Mozilla/5.0 (Linux; Tizen 2.3) AppleWebKit/538.1 (KHTML, like Gecko)Version/2.3 TV Safari/538.1"
  targets:
   - name: livego
     options:
         ignore_logo: true
     output:
       - type: m3u
         filename: pl1.m3u
     sort:
       order: asc
     filter: '(Group ~ ".*Spain.*") OR (Group ~ ".*Belgium.*")'
     mapping:
       - spain

mapping.yml

---
mappings:
  templates:
    - name: spain
      value: 'Group ~ ".*Spain.*"'
    - name: source
      value: 'Url ~ "https?:\/\/(.*?)\/(?P<query>.*)$"'
  mapping:
    - id: spain
      mapper:
        - filter: '!spain!'
          pattern: '!source!'

playlist

#EXTM3U
#EXTINF:-1 tvg-ID="axn.rs" tvg-name="CRO: AXN Adria" tvg-logo="[" group-title="Hrvatska",CRO: AXN Adria
http://localhost:7000/quinones/secret/90002
#EXTINF:-1 tvg-ID="axnspin.rs" tvg-name="CRO: AXN Spin" tvg-logo="[" group-title="Hrvatska",CRO: AXN Spin
http://localhost:7000/quinones/secret/90002
#EXTINF:-1 tvg-ID="AXN.rs" tvg-name="RS: AXN" tvg-logo="" group-title="Srbija & MN",RS: AXN
http://localhost:7000/quinones/secret/90002
#EXTINF:-1 tvg-ID="axnspin.rs" tvg-name="RS: AXN Spin" tvg-logo="" group-title="Srbija & MN",RS: AXN Spin
http://localhost:7000/quinones/secret/90002
#EXTINF:-1 tvg-ID="axn.es" tvg-name="ES: AXN FHD" tvg-logo="[""]" group-title="Spain",ES: AXN FHD
http://localhost:7000/quinones/secret/90002
#EXTINF:-1 tvg-ID="axn.es" tvg-name="ES: AXN HD" tvg-logo="[""]" group-title="Spain",ES: AXN HD
http://localhost:7000/quinones/secret/90002
#EXTINF:-1 tvg-ID="axn.es" tvg-name="ES: Axn Spain" tvg-logo="[""]" group-title="Spain",ES: Axn Spain
http://localhost:7000/quinones/secret/90002
#EXTINF:-1 tvg-ID="axnwhite.es" tvg-name="ES: AXN White FHD" tvg-logo="[" group-title="Spain",ES: AXN White FHD
http://localhost:7000/quinones/secret/90002
#EXTINF:-1 tvg-ID="axnwhite.es" tvg-name="ES: AXN WHITE HD" tvg-logo="" group-title="Spain",ES: AXN WHITE HD
http://localhost:7000/quinones/secret/90002
#EXTINF:-1 tvg-ID="axnwhite.es" tvg-name="ES: Axn White Spain" tvg-logo="[""]" group-title="Spain",ES: Axn White Spain
http://localhost:7000/quinones/secret/90002
#EXTINF:-1 tvg-ID="axn.de" tvg-name="DE: AXN FHD" tvg-logo="[" group-title="Germany",DE: AXN FHD
http://localhost:7000/quinones/secret/90002
#EXTINF:-1 tvg-ID="axn.de" tvg-name="DE: AXN HD" tvg-logo="[" group-title="Germany",DE: AXN HD
http://localhost:7000/quinones/secret/90002
#EXTINF:-1 tvg-ID="NULL" tvg-name="PT: AXN FHD" tvg-logo="" group-title="Portugal",PT: AXN FHD
http://localhost:7000/quinones/secret/90002
#EXTINF:-1 tvg-ID="axn.pt" tvg-name="PT: AXN HD" tvg-logo="[" group-title="Portugal",PT: AXN HD
http://localhost:7000/quinones/secret/90002
#EXTINF:-1 tvg-ID="NULL" tvg-name="PT: AXN MOVIES FHD" tvg-logo="" group-title="Portugal",PT: AXN MOVIES FHD
http://localhost:7000/quinones/secret/90002
#EXTINF:-1 tvg-ID="NULL" tvg-name="PT: AXN MOVIES HD" tvg-logo="" group-title="Portugal",PT: AXN MOVIES HD
http://localhost:7000/quinones/secret/90002
#EXTINF:-1 tvg-ID="axnwhite.pt" tvg-name="PT: AXN WHITE FHD" tvg-logo="[" group-title="Portugal",PT: AXN WHITE FHD
http://localhost:7000/quinones/secret/90002
#EXTINF:-1 tvg-ID="axnwhite.pt" tvg-name="PT: AXN WHITE HD" tvg-logo="[" group-title="Portugal",PT: AXN WHITE HD
http://localhost:7000/quinones/secret/90002
#EXTINF:-1 tvg-ID="axn.pt" tvg-name="PT: AXN Movies FHD" tvg-logo="[" group-title="Portugal",PT: AXN Movies FHD
http://localhost:7000/quinones/secret/90002
#EXTINF:-1 tvg-ID="axnblack.pt" tvg-name="PT: AXN Movies HD" tvg-logo="[" group-title="Portugal",PT: AXN Movies HD
http://localhost:7000/quinones/secret/90002
#EXTINF:-1 tvg-ID="" tvg-name="SK: AXN" tvg-logo="" group-title="Slovakia",SK: AXN
http://localhost:7000/quinones/secret/90002
#EXTINF:-1 tvg-ID="" tvg-name="SK: AXN Black" tvg-logo="" group-title="Slovakia",SK: AXN Black
http://localhost:7000/quinones/secret/90002
#EXTINF:-1 tvg-ID="" tvg-name="SK: AXN White" tvg-logo="" group-title="Slovakia",SK: AXN White
http://localhost:7000/quinones/secret/90002
#EXTINF:-1 tvg-ID="axnblack.pl" tvg-name="PL: AXN Black" tvg-logo="" group-title="Poland",PL: AXN Black
http://localhost:7000/quinones/secret/90002
#EXTINF:-1 tvg-ID="AXN (HD).hu" tvg-name="HU: AXN" tvg-logo="" group-title="Hungary",HU: AXN
http://localhost:7000/quinones/secret/90002
#EXTINF:-1 tvg-ID="AXN (HD).hu" tvg-name="HU: AXN Black" tvg-logo="[""]" group-title="Hungary",HU: AXN Black
http://localhost:7000/quinones/secret/90002
#EXTINF:-1 tvg-ID="AXN (HD).hu" tvg-name="HU: AXN White" tvg-logo="[""]" group-title="Hungary",HU: AXN White
http://localhost:7000/quinones/secret/90002

And the result is:

#EXTM3U
#EXTINF:-1 tvg-id="axn.es" tvg-name="ES: AXN FHD" group-title="Spain",ES: AXN FHD
http://localhost:7000/quinones/secret/90002
#EXTINF:-1 tvg-id="axn.es" tvg-name="ES: AXN HD" group-title="Spain",ES: AXN HD
http://localhost:7000/quinones/secret/90002
#EXTINF:-1 tvg-id="axn.es" tvg-name="ES: Axn Spain" group-title="Spain",ES: Axn Spain
http://localhost:7000/quinones/secret/90002
#EXTINF:-1 tvg-id="axnwhite.es" tvg-name="ES: AXN White FHD" group-title="Spain",ES: AXN White FHD
http://localhost:7000/quinones/secret/90002
#EXTINF:-1 tvg-id="axnwhite.es" tvg-name="ES: AXN WHITE HD" group-title="Spain",ES: AXN WHITE HD
http://localhost:7000/quinones/secret/90002
#EXTINF:-1 tvg-id="axnwhite.es" tvg-name="ES: Axn White Spain" group-title="Spain",ES: Axn White Spain
http://localhost:7000/quinones/secret/90002

There are only Spain channels. How are you accessing the generated playlist ?

I'm accesting the playlist through the api.
Like so http://localhost:8901/get.php?token=abcde

euzu commented

@davidclaeysquinones yes this is the right way. Something in your configuration must be different than what i have used.
Because i get the right result, nothing wrong.

if you dont plan to access the files then you should not use

  • filename: pl1.m3u the processed result
  • persist: 'playlist_1_{}.m3u' the original playlist

The api to access the playlist does not use the persisted m3u files. This files are only keep a copy of the provider playlist and copy the result to somewhere else.

The playlist of my provider is trash.
I wouldn't mind sending you the complete file through PM

euzu commented

Github does not support PM. You can send it to me anonymized via wetransfer. (password protected zip or 7z)

After receiving you can delete your message content here on github.

Can I have your email ?

I just send you the playlist through Wetransfer

euzu commented

i did not receive any link , where did you send it ?

I send it to ...

euzu commented

sorry i dont have access to the email address currently.

can you send it to euzu@jaga.email please

I've sent it to the new address

I've sent it again , did you receive it ?

euzu commented

Yes i received it, i will look at it tomorrow.

euzu commented

@davidclaeysquinones it works as expected. i am getting 4 groups
spain, spain sports events, belgium and belgium sports events.

I dont know what you are doing wrong, but the config i used is the same i posted above.

The mapping.yml does nothing, because there is no action defined. If you dont have anything you should not use mapping.

I forced a download of the playlist and the issue seems to have disappeared

euzu commented

@davidclaeysquinones ok then i close this issue