Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions config/config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ open_update_time = True
open_url_info = False
# 开启 EPG 功能,支持频道显示预告内容;可选值: True, False | Enable EPG function, support channel display preview content; Optional values: True, False
open_epg = True
# M3U 全局 catchup 类型,留空则不输出;可选值: append、shift、default、vod 等 | M3U global catchup type, leave empty to not output; Optional values: append, shift, default, vod, etc.
catchup =
# M3U 全局 catchup-source 地址模板,留空则不输出 | M3U global catchup-source url template, leave empty to not output
catchup_source =
# 开启转换生成 m3u 文件类型结果链接,支持显示频道图标;可选值: True, False | Enable to convert and generate m3u file type result links, support display channel icons; Optional values: True, False
open_m3u_result = True
# 单个频道接口数量 | Number of interfaces per channel
Expand Down
8 changes: 8 additions & 0 deletions utils/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,14 @@ def open_headers(self):
def open_epg(self):
return self.config.getboolean("Settings", "open_epg", fallback=True)

@property
def catchup(self):
return self.config.get("Settings", "catchup", fallback="").strip()

@property
def catchup_source(self):
return self.config.get("Settings", "catchup_source", fallback="").strip()

@property
def speed_test_limit(self):
return self.config.getint("Settings", "speed_test_limit", fallback=5)
Expand Down
10 changes: 9 additions & 1 deletion utils/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,15 @@ def convert_to_m3u(path=None, first_channel_name=None, data=None):
"""
if os.path.exists(path):
with open(path, "r", encoding="utf-8") as file:
m3u_output = f'#EXTM3U x-tvg-url="{get_epg_url()}"\n' if config.open_epg else "#EXTM3U\n"
# 构建 #EXTM3U 行的属性
extm3u_attrs = []
if config.open_epg:
extm3u_attrs.append(f'x-tvg-url="{get_epg_url()}"')
if config.catchup:
extm3u_attrs.append(f'catchup="{config.catchup}"')
if config.catchup_source:
extm3u_attrs.append(f'catchup-source="{config.catchup_source}"')
m3u_output = f'#EXTM3U {" ".join(extm3u_attrs)}\n' if extm3u_attrs else "#EXTM3U\n"
current_group = None
logo_url = get_logo_url()
from_fanmingming = "https://raw.githubusercontent.com/fanmingming/live/main/tv" in logo_url
Expand Down
Loading