Add support for customising the M3U tag name for EPG channel id

This commit is contained in:
Mat Gadd
2025-11-07 03:09:32 +00:00
parent 629171b1d0
commit 7d98211d48
2 changed files with 5 additions and 2 deletions

View File

@@ -118,7 +118,8 @@ GET /m3u
- `wanted_groups` (optional): A comma-separated list of group names to include (takes precedence over unwanted_groups)
- `nostreamproxy` (optional): Set to 'true' to disable stream proxying
- `proxy_url` (optional): Custom base URL for proxied content (overrides auto-detection)
- `include_channel_id` (optional): Set to 'true' to include `channel-id` in M3U, useful for [Channels](https://getchannels.com)
- `include_channel_id` (optional): Set to 'true' to include `epg_channel_id` in M3U, useful for [Channels](https://getchannels.com)
- `channel_id_tag` (optional): Name of the tag to use for `epg_channel_id` data in M3U, defaults to `channel-id`
Note: For `unwanted_groups` and `wanted_groups`, you can use wildcard patterns with `*` and `?` characters. For example:
- `US*` will match all groups starting with "US"

4
run.py
View File

@@ -618,6 +618,7 @@ def generate_m3u():
no_stream_proxy = str(data.get("nostreamproxy", "")).lower() == "true"
include_vod = str(data.get("include_vod", "false")).lower() == "true"
include_channel_id = str(data.get("include_channel_id", "false")).lower() == "true"
channel_id_tag = str(data.get("channel_id_tag", "channel-id"))
logger.info("🔄 Processing POST request for M3U generation")
else:
unwanted_groups = parse_group_list(request.args.get("unwanted_groups", ""))
@@ -625,6 +626,7 @@ def generate_m3u():
no_stream_proxy = request.args.get("nostreamproxy", "").lower() == "true"
include_vod = request.args.get("include_vod", "false").lower() == "true"
include_channel_id = request.args.get("include_channel_id", "false") == "true"
channel_id_tag = request.args.get("channel_id_tag", "channel-id")
logger.info("🔄 Processing GET request for M3U generation")
# For M3U generation, warn about VOD performance impact
@@ -741,7 +743,7 @@ def generate_m3u():
if include_channel_id:
channel_id = stream.get("epg_channel_id")
if channel_id:
tags.append(f'channel-id="{channel_id}"')
tags.append(f'{channel_id_tag}="{channel_id}"')
# Create the stream URL based on content type
if content_type == "live":