2022-04-01 14:43:18 +02:00
2022-04-21 17:21:37 +02:00
2023-01-12 15:59:40 +01:00
2021-10-07 20:11:54 +02:00
2023-01-12 15:59:40 +01:00
2023-01-12 15:59:40 +01:00
2023-01-12 15:59:40 +01:00
2021-09-22 10:55:12 +02:00
2022-04-21 17:17:09 +02:00

m3u-filter

m3u-filter is a simple application which can filter entries out of a playlist in EXTM3U format. If you have a playlist which contains unwanted entries, you can create filter which include or discard entries based on the header information of the playlist entries. Currently filter and rename operations support group, name and title fields.

You can run m3u-filter as command line application to update your playlists (manually or as cron job), or you can run it in server mode and open the web-ui to see the contents of the playlist, filter/search content and save the filtered groups as a new playlist.

You can define multiple targets for filtering if you want to create multiple playlists from a big playlist.

The config.yml file contains the filter and rename definitions. It should be located next to the exe file or in the current working directory. You can override this behaviour with the -c argument. The input file can be defined inside the config.yml file or can be given as -i argument. If given as argument, it overrides the config file entry.

There are two types of targets m3u and strm. This can be set by the output attribute to Strm or M3u. If the attribute is not specified M3u is created by default.

Strm output has additional options underscore_whitespace, cleanup and kodi_style. underscore_whitespace replaces all whitespaces with _ in the path. cleanup deletes the directory given at filename. kodi_style tries to rename filename with kodi style.

the config.yml looks like:

working_dir: ./data
api:
  host: localhost
  port: 8901
  web_root: ./web
input:
  url: http://myserver.net/playlist.m3u
  persist: ./playlist_{}.m3u
targets:
  - filename: playlist_1.m3u
    options:
      ignore_logo: true
    sort:
      order: Asc
    filter: Group ~ "^DE\s.*" OR Group ~ "^AU\s.*" 
    rename:
      - field: Group
        pattern: ^DE(.*)
        new_name: 1. DE$1
  - filename: playlist_strm
    output: Strm
    options:
      ignore_logo: true
      underscore_whitespace: false
      kodi_style: true
      cleanup: true
    sort:
      order: Asc
    filter: Group ~ "^DE\s.*" OR Group ~ "^AU\s.*"
    rename:
      - field: Group
        pattern: ^DE(.*)
        new_name: 1. DE$1

The input url can be an url or filename. If you have a local file you can simply write the name of the file as url:

input:
  url: playlist.m3u

The input persist configuration is for storing the input content. The {} is replaced by a date time tag. If you don't want to persist the input content, then let it empty.

The filter can have UnaryExpression NOT, BinaryExpression AND OR, and Comparison (Group|Title|Name|Url) ~ "regexp" Filter fields are Group, Title, Name and Url.

Example filter: ((Group ~ "^DE.*") AND (NOT Title ~ ".*Shopping.*")) OR (Group ~ "^AU.*")

The regular expression syntax is similar to Perl-style regular expressions, but lacks a few features like look around and backreferences.

The rename supports capture groups. Each group can be adressed with $1, $2 .. in the new_name attribute. This is needed for players which do not observe the order and sort themselves. In the above example each entry starting with DE will be prefixed with "1.". If you dont care about sorting, you dont need the rename block.

The EXTM3U format is an extension of the M3U format.

m3u has become almost a standard for the formation of playlists of media players and media devices.

A file in the EXTM3U format is a text file with the extension m3u or m3u8.

An example of the contents of the file in the EXTM3U format

#EXTM3U
#EXTINF:-1 tvg-name="Channel 1" tvg-logo="http://site.domain/channel1_logo.png" group-title="Group 1",Channel 1
http://site.domain/channel1
#EXTINF:-1 tvg-name="Channel 2" tvg-logo="http://site.domain/channel2_logo.png"  group-title="Group 2",Channel 2
http://site.domain/channel2
#EXTINF:-1 tvg-name="Channel 3" tvg-logo="http://site.domain/channel3_logo.png"  group-title="Group 2",Channel 3
http://site.domain/channel3

Starting in server mode for Web-UI

If you want to see the contents of a playlist, you can simply start with the -s (--server) argument. Other arguments are ignored. A server is started. You can open a browser to view the Web-UI. According to your configuration, use the printed url on console. The UI allows you to download a list. You can download the list with the Save Button. The downloaded list only contains non-selected entries.

Cross compile for windows on linux

If you want to compile this project on linux for windows, you need to do the following steps.

Install mingw packages for your distribution

For ubuntu type:

sudo apt-get install gcc-mingw-w64

Install mingw support for rust

rustup target add x86_64-pc-windows-gnu
rustup toolchain install stable-x86_64-pc-windows-gnu

Compile it with:

cargo build --release --target x86_64-pc-windows-gnu
S
Description
Flexible IPTV playlist processor & proxy in Rust 🦀 - supports M3U, Xtream Codes, HDHomeRun, Plex, Emby & Jellyfin. Filtering, merging, scheduling & web delivery.
Readme MIT
159 MiB
v3.3.0
Latest
2026-04-02 14:05:15 +02:00
Languages
Rust 96.9%
SCSS 2.3%
Shell 0.5%