hoshsadiq / m3ufilter

ABANDONED - A tool that allows to filter specific items from an m3u filter designed for IPTV.
GNU General Public License v2.0
49 stars 18 forks source link

Operator using YAML to filter channels #34

Closed Pcsl closed 3 years ago

Pcsl commented 3 years ago

This is not really a bug nor a feature request, as the only thing I need is some help to set up the config file as I'm having serious problems to understand how to work with YAML. What I'm trying is to remove from my list channels that end with mkv (as they are just movies and not real live channels.

I tried following your config file but it says the syntax is not correct when using: - !match(Uri, "mkv").

This is my code:

core:
  server_listen: localhost:8090
  update_schedule: "*/24 * * * *"
  output: m3u
  group_order:
    - Entertainment
    - Family/Kids
    - News
    - Drama
providers:
  - uri: myserverurl
    filters:
      - !match(Uri, "mkv")
    setters:
      - name: replace(Name, "[\\s\\:\\|]+", " ")
      - name: replace(Name, "^VIP ", "")
      - name: replace(Name, "USA", "")
        attributes:
          tvg-id: tvg_id(Name) + ".us"
        filters:
          - Name == "USA CNN"
          - Name == "CNN"
          - Name == "CNN HD"
epg_providers:
  - uri: myserverurl
    channel_id_renames:
      replacement: find # key = what to replace it with, value = what to find
      bbc.uk: "BBC One"
stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

hoshsadiq commented 3 years ago

Hi, sorry I've not had a chance to look at this yet. I will hopefully find some time this week. Meanwhile, can you post a little bit of the m3u file? Please make sure you sensor sensitive data (usernames/passwords etc).

Pcsl commented 3 years ago

Thank you very much for your help as this language is completely new to me. This is a sample of my M3U file.

I would like for example to remove all MKV channels and the ones containing CNN if possible (mainly to understand how it works).

#EXTM3U
#EXTINF:-1 tvg-id="" tvg-name="Harley Quinn S01 E06" tvg-logo="http://server.com:8880/images.jpg" group-title="Multiple EPS",Harley Quinn S01 E06
http://server.com:8880/314r12.mkv
#EXTINF:-1 tvg-id="" tvg-name="Harley Quinn S01 E07" tvg-logo="http://server.com:8880/images2.jpg" group-title="Multiple EPS",Harley Quinn S01 E07
http://server.com:8880/61412asr.mkv
#EXTINF:-1 tvg-id="" tvg-name="Harley Quinn S01 E08" tvg-logo="http://server.com:8880/images3.jpg" group-title="Multiple EPS",Harley Quinn S01 E08
http://server.com:8880/asffafwqr1.mkv
#EXTINF:-1 tvg-id="" tvg-name="Harley Quinn S01 E09" tvg-logo="http://server.com:8880/images4.jpg" group-title="Multiple EPS",Harley Quinn S01 E09
http://server.com:8880/ararasr.mkv
#EXTINF:-1 tvg-id="" tvg-name="Harley Quinn S01 E10" tvg-logo="http://server.com:8880/images5.jpg" group-title="Multiple EPS",Harley Quinn S01 E10
http://server.com:8880/15125125.mkv
#EXTINF:-1 tvg-id="" tvg-name="Harley Quinn S01 E11" tvg-logo="http://server.com:8880/images6.jpg" group-title="Multiple EPS",Harley Quinn S01 E11
http://server.com:8880/15215412.mkv
#EXTINF:-1 tvg-id="" tvg-name="------|USA|------" tvg-logo="http://server.com:8880/------|USA|------.png" group-title="USA General",------|USA|------
http://server.com:8880/32168
#EXTINF:-1 tvg-id="" tvg-name="USA:-----|GENERAL|--------------------------------" tvg-logo="http://server.com:8880/------|USA|------.png" group-title="USA General",USA:-----|GENERAL|--------------------------------
http://server.com:8880/689564
#EXTINF:-1 tvg-id="a.e.eastern.us" tvg-name="US001:A&E-HD" tvg-logo="http://server.com:8880/US001A&E-HD.png" group-title="USA General",US001:A&E-HD
http://server.com:8880/689556
#EXTINF:-1 tvg-id="cnn1" tvg-name="CNN HD" tvg-logo="http://server.com:8880/US078CNN.png" group-title="USA General",USA078:CNN HD
http://server.com:8880/12467
#EXTINF:-1 tvg-id="cnn.ca" tvg-name="USA CNN" tvg-logo="http://server.com:8880/113CNN.png" group-title="USA General",US113:CNN HD
http://server.com:8880/30412456
#EXTINF:-1 tvg-id="" tvg-name="US018:CBSN-HD" tvg-logo="http://server.com:8880/US018CBSN-HD.png" group-title="USA General",US018:CBSN-HD
http://server.com:8880/31241

Thank you!

hoshsadiq commented 3 years ago

This should do the trick

    filters:
      - |
        !match(Uri, "mkv") &&
        !match(Name, "CNN")

Note, the syntax issue is because of the yaml parser. Not really sure why it's failing but eh. You can bypass it by either using multi-line yaml value (the |), or you can quote your filter (e.g. - '!match(Uri, "mkv")')