Do you have IPTV provider who doesn't add groups to channels, but uses channel names for it? This script will attach channel-like categories to channels under them.
Go to file
franek 121b9cce15
fix: first channel without category
due to dynamic playlist changing, enumerate() wasn't working properly
2024-03-25 20:30:20 +01:00
__main__.py fix: first channel without category 2024-03-25 20:30:20 +01:00
.gitignore Initial commit 2024-02-25 17:02:13 +01:00
README.md update: quick readme update 2024-02-25 19:44:06 +01:00
requirements.txt Initial commit 2024-02-25 17:02:13 +01:00

M3U Category Matcher

Do you have IPTV provider who doesn't add groups to channels, but uses channel names for it? This script will attach "channel-like" categories to channels under them. Example:

You have these 5 channels:

  1. ### GENERAL ###
  2. TV1 HD
  3. TV2 HD
  4. ### MUSIC ###
  5. METAL LIVE TV HD

For example, if you provided \#\#\# (.*) \#\#\# regex: This script will remove channel with no. 1. and 5., then attach categories:

  • GENERAL (matched group from regex!) to channels 2, 3,
  • MUSIC to channel 5.

NOTE!

This script is in BETA phase. Please report any bugs!

Based on

  • argparse
  • pathlib
  • re
  • ipytv

Usage

python3 <path-to-script> -i "<m3u path>" -r "<regex to match>" (-v)

Result

When everything is done, file is OVERWRITTEN!

Example usage

python3 <path-to-script> -i "m3u_list.m3u" -r "\#\#\# (.*) \#\#\#"

Available parameters

  • -i/--input - absolute path to m3u+ file
  • -r/--regex - regular expression used to match categories in channel names
  • -v/--verbose - enable verbose mode