mirror of
https://github.com/euzu/tuliprox.git
synced 2026-10-25 08:12:19 +01:00
67 lines
2.7 KiB
Markdown
67 lines
2.7 KiB
Markdown
# 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 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.
|
|
|
|
the config.yml looks like:
|
|
```yaml
|
|
input:
|
|
url: http://myserver.net/playlist.m3u
|
|
persist: ./playlist_{}.m3u
|
|
targets:
|
|
- filename: playlist_1.m3u
|
|
filter:
|
|
mode: Include
|
|
rules:
|
|
- field: Group
|
|
pattern: ^DE\s.*
|
|
- field: Group
|
|
pattern: ^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:
|
|
```yaml
|
|
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 is either Include mode or Discard mode.
|
|
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
|
|
```
|