Skip to content

scenario_m3u_provider

euzu edited this page May 13, 2024 · 1 revision

m3u example config

config.yml

api: {host: 0.0.0.0, port: 8901, web_root: ./web}
log_level: info
working_dir: ./data
#schedule: 0  0  8,18  *  *  *  *
web_ui_enabled: true
web_auth:
  enabled: false
  secret: 77ac1ca497ba7153ea11a4d5695f7024
  issuer: m3u_filter
  userfile: user.txt
#messaging:
#  notify_on:
#    - info
#    - stats
#    - error
#  telegram:
#    bot_token: '<your telegram bot token'
#    chat_ids:
#      - <yout telegram chat id>

This is a basic config.yml file. The Web-Authentication is disabled.

schedule: 0 0 8,18 * * * * Means it will update the playlist twice at 08:00 and 18:00. But this depends on your docker time settings, it can be that your docker container has a different time.

If you dont want web-authentication because you use it only in your private network then skip to next section source.yml. If you want to enable, you need to set

web_auth:
  enabled: true

And you need to generate a password with

./m3u-filter --genpwd

The created password should be set in the user.txt.

The format is username: password

johndoe: $argon2id$v=19$m=19456,t=2,p=1$ZnY1NUNYU215Q1dFQ3V0MG54Wlh2T1ZRZ3UzQ0JzMTN6Tzc4cmdFSHQ3ZnY1YzRyOEMxempqblZsanJlODZZaA$JvvXhUlHDaptb86xiPNjTo1Yt/IcjLfOwlaa/uQIkT0

source.yml

templates:
- name: moviestar_group
  value: 'Group ~ "^ES\s+MOVISTAR\+$"'
- name: fhd_channels
  value: 'Name ~ ".*FHD$"'
- name: not_working
  value: >-
        (Name ~ "ES\:\sANTENA\s3\sFHD$"
        OR 
        Name ~ "ES\:\sTELECINCO\sFHD$")
- name: working_hd
  value: >-
        (Name ~ "ES\:\sANTENA\s3\sHD$"
        OR 
        Name ~ "ES\:\sTELECINCO\sHD$")
- name: moviestar
  value: >-
        !moviestar_group!
        AND 
        ((!fhd_channels! AND Not(!not_working!)) OR !working_hd!)

sources:
- inputs:
  - type: m3u
    url: '<PROVIDER_URL>'
#    epg_url: '<PROVIDER_EPG_URL>'
    name: iptv_example
  targets:
  - name: all_channels
    output:
      - type: m3u
        filename: playlist.m3u
    filter: "!moviestar!"
    options: {ignore_logo: false}
    mapping:
      - group_quality

The above example filters one group and replaces two channels with the HD quality.

First you need to define your filter templates. The following example filters everything (this is not what you want).

templates:
- name: ALL_CHANNEL
  value: 'Group ~ ".*"'

You need to set the right m3u url

- inputs:
  - type: m3u
    url: 'http://iptv.example.com:80/get.php?username=aa123456&password=supersecretpassword&type=m3u_plus&output=mpegts'

In the example the target name is set to all_cahnnels You can give the target a more meaningful name. If you change the name you have to change it in api_proxy.yml too, because a user has access to a target.

   targets:
  - name: all_channels

The example mapping is optional. What it does is: it looks for channels with the ending FHD, SD, HD and groups them.

    mapping:
      - group_quality

The name group_quality has to match the id setting in the mapping.yml.

mapping.yml

mappings:
  templates:
    - name: quality_channel
      value: 'Name ~ ".*\s(?P<quality>F?[HS]D)$"'

  tags:
    - name: quality
      captures:
        - quality
      concat: "|"
      prefix: " ["
      suffix: "]"
  mapping:
    - id: group_quality
      match_as_ascii: true
      mapper:
        - filter: "!quality_channel!"
          pattern: "!quality_channel!"
          suffix:
            group: '<tag:quality>'

Is optional, if you dont need it, then remove the mapping section in source.yml What it does is: it looks for channels with the ending FHD, SD, HD and groups them.

api_proxy.yml

server:
- name: default
  protocol: http
  host: <YOUR_LOCAL_IP>
  http_port: 8901
  https_port: ''
  rtmp_port: ''
  timezone: Europe/Rome
  message: Welcome to m3u-filter
- name: extern
  protocol: https
  host: <YOUR_EXTERNAL_DN_OR_IP>
  http_port: 8901
  https_port: ''
  rtmp_port: ''
  timezone: Europe/Rome
  message: Welcome to m3u-filter
user:
- target: all_channels
  credentials:
  - username: johndoe
    password: johndoe.secret
    token: E8qtpNy3txZy
    proxy: redirect
    server: default

This is for accessing the filtered playlists.

The default server configuration has to match your m3u-filter server. Please set host and port to the right values.

server:
- name: default
  protocol: http
  host: 192.168.0.100
  http_port: 8901

Ignore the external server configuration if you only access your playlist in your local network.

!!!! The target name has to match the target name in source.yml !!!!

api_proxy.yml

user:
- target: all_channels  <--- !! THIS !!!

source.yml

targets:
  - name: all_channels   <--- !! THIS !!!

You can define a user per target. Token is optional and can be used instead of username/password combi

user:
- target: all_channels
  credentials:
  - username: johndoe
    password: johndoe.secret
    token: E8qtpNy3txZy
    proxy: redirect
    server: default

The defined user can choose from the following m3u urls to access the playlist. (You need only one not all)

Clone this wiki locally