Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release:v1.5.7 #726

Merged
merged 6 commits into from
Dec 23, 2024
Merged
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
44 changes: 44 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,49 @@
# 更新日志(Changelog)

## v1.5.7

### 2024/12/23

- ❤️ 推荐关注微信公众号(Govin),订阅更新通知与使用技巧等文章推送,还可进行答疑和交流讨论
- ⚠️ 本次更新涉及配置变更,以最新 `config/config.ini` 为准,工作流用户需复制最新配置至`user_config.ini`
,Docker用户需清除主机挂载的旧配置
- ✨ 新增补偿机制模式(open_supply),用于控制是否开启补偿机制,当满足条件的结果数量不足时,将可能可用的接口补充到结果中
- ✨ 新增支持通过配置修改服务端口(app_port)
- ✨ 新增ghgo.xyz CDN代理加速
- ✨ config.ini配置文件新增注释说明(#704
- ✨ 更新酒店源与组播源离线数据
- 🐛 修复IPv6接口测速异常低速率问题(#697#713
- 🐛 修复Sort接口可能出现的超时等待问题(#705#719
- 🐛 修复历史白名单结果导致移除白名单无效问题(#713
- 🐛 修复订阅源白名单无效问题(#724
- 🪄 优化更新时间url使用首个频道接口地址
- 🪄 优化接口来源偏好可设置为空,可实现全部来源按速率排序输出结果

<details>
<summary>English</summary>

- ❤️ Recommended to follow the WeChat public account (Govin) to subscribe to update notifications and articles on usage
tips, as well as for Q&A and discussion.
- ⚠️ This update involves configuration changes. Refer to the latest `config/config.ini`. Workflow users need to copy
the latest configuration to `user_config.ini`, and Docker users need to clear the old configuration mounted on the
host.
- ✨ Added compensation mechanism mode (open_supply) to control whether to enable the compensation mechanism. When the
number of results meeting the conditions is insufficient, potentially available interfaces will be supplemented into
the results.
- ✨ Added support for modifying the server port through configuration (app_port).
- ✨ Added ghgo.xyz CDN proxy acceleration.
- ✨ Added comments to the config.ini configuration file (#704).
- ✨ Updated offline data for hotel sources and multicast sources.
- 🐛 Fixed the issue of abnormally low speed rates for IPv6 interface speed tests (#697, #713).
- 🐛 Fixed the issue of possible timeout waiting in the Sort interface (#705, #719).
- 🐛 Fixed the issue where historical whitelist results caused the removal of the whitelist to be ineffective (#713).
- 🐛 Fixed the issue where the subscription source whitelist was ineffective (#724).
- 🪄 Optimized the update time URL to use the first channel interface address.
- 🪄 Optimized the interface source preference to be set to empty, allowing all sources to be sorted by speed for output
results.

</details>

## v1.5.6

### 2024/12/17
Expand Down
2 changes: 2 additions & 0 deletions config/config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ open_service = True
open_sort = True
# 开启订阅源功能; 可选值: True, False | Enable subscription source function; Optional values: True, False
open_subscribe = True
# 开启补偿机制模式,用于控制当频道接口数量不足时,自动将不满足条件(例如低于最小速率)但可能可用的接口添加至结果中,从而避免结果为空的情况; 可选值: True, False | Enable compensation mechanism mode, used to control when the number of channel interfaces is insufficient, automatically add interfaces that do not meet the conditions (such as lower than the minimum rate) but may be available to the result, thereby avoiding the result being empty; Optional values: True, False
open_supply = True
# 开启更新,用于控制是否更新接口,若关闭则所有工作模式(获取接口和测速)均停止; 可选值: True, False | Enable update, used to control whether to update the interface, if closed, all working modes (get interface and speed measurement) will stop; Optional values: True, False
open_update = True
# 开启显示更新时间; 可选值: True, False | Enable display update time; Optional values: True, False
Expand Down
20 changes: 20 additions & 0 deletions tkinter_ui/prefer.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,22 @@ def init_ui(self, root=None):
input.entry.bind("<KeyRelease>", input.update_input)
self.ipv_type_input.append(input)

frame_prefer_open_supply = tk.Frame(root)
frame_prefer_open_supply.pack(fill=tk.X)
self.open_supply_label = tk.Label(
frame_prefer_open_supply, text="开启补偿模式:", width=12
)
self.open_supply_label.pack(side=tk.LEFT, padx=4, pady=8)
self.open_supply_var = tk.BooleanVar(value=config.open_supply)
self.open_supply_checkbutton = ttk.Checkbutton(
frame_prefer_open_supply,
variable=self.open_supply_var,
onvalue=True,
offvalue=False,
command=self.update_open_supply,
)
self.open_supply_checkbutton.pack(side=tk.LEFT, padx=4, pady=8)

def get_origin_type_prefer_index(self, origin_type_prefer):
index_list = [None, None, None, None]
origin_type_prefer_obj = {
Expand All @@ -67,12 +83,16 @@ def update_ipv_type_prefer(self, event):
self.prefer_ipv_type_combo.get(),
)

def update_open_supply(self):
config.set("Settings", "open_supply", str(self.open_supply_var.get()))

def change_entry_state(self, state):
for option in self.origin_type_prefer_options:
option.change_state(state)
self.prefer_ipv_type_combo.config(state=state)
for input in self.ipv_type_input:
input.change_state(state)
self.open_supply_checkbutton.config(state=state)


class IpvNumInput:
Expand Down
1 change: 1 addition & 0 deletions tkinter_ui/tkinter_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ def save_config(self):
"open_service": self.default_ui.open_service_var.get(),
"open_sort": self.speed_ui.open_sort_var.get(),
"open_subscribe": self.subscribe_ui.open_subscribe_var.get(),
"open_supply": self.prefer_ui.open_supply_var.get(),
"open_update": self.default_ui.open_update_var.get(),
"open_update_time": self.default_ui.open_update_time_var.get(),
"open_url_info": self.default_ui.open_url_info_var.get(),
Expand Down
Binary file modified updates/hotel/cache.pkl
Binary file not shown.
Binary file modified updates/multicast/cache.pkl
Binary file not shown.
24 changes: 17 additions & 7 deletions utils/channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@ def get_channel_data_from_file(channels, file, use_old, whitelist):
category_dict[name] = []
if name in whitelist:
for whitelist_url in whitelist[name]:
category_dict[name].append((whitelist_url, None, None, "important"))
category_dict[name].append((whitelist_url, None, None, "whitelist"))
if use_old and url:
info = url.partition("$")[2]
origin = None
if info and info.startswith("!"):
origin = "important"
origin = "whitelist"
data = (url, None, None, origin)
if data not in category_dict[name]:
category_dict[name].append(data)
Expand All @@ -74,6 +74,7 @@ def get_channel_items():
user_source_file = resource_path(config.source_file)
channels = defaultdict(lambda: defaultdict(list))
whitelist = get_name_urls_from_file(constants.whitelist_path)
whitelist_urls = get_urls_from_file(constants.whitelist_path)
whitelist_len = len(list(whitelist.keys()))
if whitelist_len:
print(f"Found {whitelist_len} channel in whitelist")
Expand All @@ -100,6 +101,12 @@ def get_channel_items():
if name in old_result[cate]:
for info in old_result[cate][name]:
if info:
try:
if info[3] == "whitelist" and not any(
url in info[0] for url in whitelist_urls):
continue
except:
pass
pure_url = info[0].partition("$")[0]
if pure_url not in urls:
channels[cate][name].append(info)
Expand Down Expand Up @@ -449,13 +456,16 @@ def append_data_to_info_data(info_data, cate, name, data, origin=None, check=Tru
if not url_origin:
continue
if url:
pure_url = url.partition("$")[0]
if pure_url in urls:
url_partition = url.partition("$")
pure_url = url_partition[0]
url_info = url_partition[2]
white_info = url_info and url_info.startswith("!")
if (pure_url in urls) and not white_info:
continue
if whitelist and check_url_by_keywords(url, whitelist):
url_origin = "important"
if white_info or (whitelist and check_url_by_keywords(url, whitelist)):
url_origin = "whitelist"
if (
url_origin == "important"
url_origin == "whitelist"
or (not check)
or (
check and check_url_ipv_type(pure_url) and not check_url_by_keywords(url, blacklist))
Expand Down
4 changes: 4 additions & 0 deletions utils/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,10 @@ def open_empty_category(self):
def app_port(self):
return os.environ.get("APP_PORT") or self.config.getint("Settings", "app_port", fallback=8000)

@property
def open_supply(self):
return self.config.getboolean("Settings", "open_supply", fallback=True)

def load(self):
"""
Load the config
Expand Down
7 changes: 4 additions & 3 deletions utils/speed.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ def sort_urls(name, data, logger=None):
"resolution": resolution,
"origin": origin
}
if origin == "important":
if origin == "whitelist":
filter_data.append(result)
continue
cache_key_match = re.search(r"cache:(.*)", url.partition("$")[2])
Expand All @@ -295,7 +295,8 @@ def sort_urls(name, data, logger=None):
)
except Exception as e:
print(e)
if config.open_filter_speed and speed < config.min_speed:
if (not config.open_supply and config.open_filter_speed and speed < config.min_speed) or (
config.open_supply and delay is None):
continue
result["delay"] = delay
result["speed"] = speed
Expand All @@ -304,7 +305,7 @@ def sort_urls(name, data, logger=None):

def combined_key(item):
speed, origin = item["speed"], item["origin"]
if origin == "important":
if origin == "whitelist":
return float("inf")
else:
return speed if speed is not None else float("-inf")
Expand Down
8 changes: 4 additions & 4 deletions utils/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,10 @@ def get_total_urls(info_list, ipv_type_prefer, origin_type_prefer):
if not origin:
continue

if origin == "important":
im_url, _, im_info = url.partition("$")
im_info_value = im_info.partition("!")[2]
total_urls.append(f"{im_url}${im_info_value}" if im_info_value else im_url)
if origin == "whitelist":
w_url, _, w_info = url.partition("$")
w_info_value = w_info.partition("!")[2] or "白名单"
total_urls.append(add_url_info(w_url, w_info_value))
continue

if origin == "subscribe" and "/rtp/" in url:
Expand Down
2 changes: 1 addition & 1 deletion version.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"version": "1.5.6",
"version": "1.5.7",
"name": "IPTV-API"
}