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

dev #512

Merged
merged 10 commits into from
Nov 5, 2024
Merged

dev #512

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
6 changes: 0 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,9 @@ jobs:
if [[ -f "$final_file" ]]; then
git add -f "$final_file"
fi
if [[ -f "result.txt" ]]; then
git add -f "result.txt"
fi
if [[ -f "$final_m3u_file" ]]; then
git add -f "$final_m3u_file"
fi
if [[ -f "result.m3u" ]]; then
git add -f "result.m3u"
fi
if [[ -f "output/result_cache.pkl" ]]; then
git add -f "output/result_cache.pkl"
fi
Expand Down
7 changes: 4 additions & 3 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@
https://ghproxy.net/raw.githubusercontent.com/Guovin/TV/gd/output/result.m3u
```

```bash
https://ghproxy.net/raw.githubusercontent.com/Guovin/TV/gd/output/result.txt
```

- 数据源:

```bash
Expand Down
4 changes: 4 additions & 0 deletions README_en.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@
https://ghproxy.net/raw.githubusercontent.com/Guovin/TV/gd/output/result.m3u
```

```bash
https://ghproxy.net/raw.githubusercontent.com/Guovin/TV/gd/output/result.txt
```

- Data source:

```bash
Expand Down
2 changes: 1 addition & 1 deletion config/config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ hotel_region_list = 全部
hotel_page_num = 1
open_update_time = True
request_timeout = 10
origin_type_prefer = subscribe,hotel,multicast,online_search
origin_type_prefer = hotel,multicast,subscribe,online_search
hotel_num = 10
multicast_num = 10
subscribe_num = 10
Expand Down
8 changes: 0 additions & 8 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
from time import time
from flask import Flask, render_template_string
import sys
import shutil
import atexit
import pickle
import copy
Expand Down Expand Up @@ -189,13 +188,6 @@ async def main(self):
self.pbar.close()
user_final_file = config.final_file
update_file(user_final_file, "output/result_new.txt")
if os.path.exists(user_final_file):
result_file = (
"user_result.txt"
if os.path.exists("config/user_config.ini")
else "result.txt"
)
shutil.copy(user_final_file, result_file)
if config.open_use_old_result:
if open_sort:
get_channel_data_cache_with_compare(
Expand Down
4 changes: 2 additions & 2 deletions utils/channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,8 @@ def append_data_to_info_data(
try:
url, date, resolution, *rest = item
url_origin = origin or (rest[0] if rest else None)
if not url_origin:
continue
if url:
pure_url = url.partition("$")[0]
if pure_url in urls:
Expand All @@ -523,8 +525,6 @@ def get_origin_method_name(method):
"""
Get the origin method name
"""
if method in ["hotel_tonkiang", "hotel_fofa"] and not config.open_hotel:
return None
return "hotel" if method.startswith("hotel_") else method


Expand Down
2 changes: 1 addition & 1 deletion utils/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def origin_type_prefer(self):
for origin in self.config.get(
"Settings",
"origin_type_prefer",
fallback="subscribe,hotel,multicast,online_search",
fallback="hotel,multicast,subscribe,online_search",
).split(",")
if origin.strip().lower()
]
Expand Down
2 changes: 1 addition & 1 deletion utils/speed.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ async def sort_urls_by_speed_and_resolution(
valid_response = [res for res in response if res != float("inf")]

def combined_key(item):
(_, _, resolution), response_time = item
(_, _, resolution, _), response_time = item
resolution_value = get_resolution_value(resolution) if resolution else 0
return (
-(config.response_time_weight * response_time)
Expand Down
15 changes: 9 additions & 6 deletions utils/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,23 +136,26 @@ def get_total_urls_from_info_list(infoList, ipv6=False):

total_urls = []
for url, _, resolution, origin in infoList:
if not origin:
continue

if origin == "important":
pure_url, _, info = url.partition("$")
new_info = info.partition("!")[2]
total_urls.append(f"{pure_url}${new_info}" if new_info else pure_url)
continue

if origin == "subscribe" and "/rtp/" in url:
origin = "multicast"

if origin not in origin_type_prefer:
continue

if config.open_filter_resolution and resolution:
resolution_value = get_resolution_value(resolution)
if resolution_value < config.min_resolution_value:
continue

if not origin or (origin not in origin_type_prefer):
continue

if origin == "subscribe" and "/rtp/" in url:
origin = "multicast"

url_is_ipv6 = is_ipv6(url)
if url_is_ipv6:
url += "|IPv6"
Expand Down
Loading