Skip to content

Commit

Permalink
Merge pull request #700 from Guovin/dev
Browse files Browse the repository at this point in the history
FIx
  • Loading branch information
Guovin authored Dec 18, 2024
2 parents 6db4e77 + 1effe28 commit e1c8a57
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions tkinter_ui/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,7 @@ def change_entry_state(self, state):
"open_request_checkbutton",
"open_driver_checkbutton",
"open_proxy_checkbutton",
"request_timeout_entry",
"source_file_entry",
"source_file_button",
"final_file_entry",
Expand Down
12 changes: 6 additions & 6 deletions utils/speed.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ async def get_speed_with_download(url: str, timeout: int = config.sort_timeout)
finally:
end_time = time()
total_time += end_time - start_time
info['speed'] = (total_size / total_time if total_time > 0 else 0) / 1024 / 1024
return info
info['speed'] = (total_size / total_time if total_time > 0 else 0) / 1024 / 1024
return info


async def get_speed_m3u8(url: str, timeout: int = config.sort_timeout) -> dict[str, float | None]:
Expand All @@ -45,7 +45,7 @@ async def get_speed_m3u8(url: str, timeout: int = config.sort_timeout) -> dict[s
"""
info = {'speed': None, 'delay': None}
try:
url = quote(url, safe=':/?$&=@').partition('$')[0]
url = quote(url, safe=':/?$&=@[]').partition('$')[0]
async with ClientSession(connector=TCPConnector(ssl=False), trust_env=True) as session:
async with session.head(url, timeout=2) as response:
if response.headers.get('Content-Length'):
Expand Down Expand Up @@ -193,10 +193,10 @@ async def get_speed(url, ipv6_proxy=None, callback=None):
if ipv6_proxy and url_is_ipv6:
data['speed'] = float("inf")
data['delay'] = float("-inf")
elif '.m3u8' in url:
data.update(await get_speed_m3u8(url))
else:
elif '/rtp/' in url:
data.update(await get_speed_with_download(url))
else:
data.update(await get_speed_m3u8(url))
if cache_key and cache_key not in cache:
cache[cache_key] = data
return data
Expand Down

0 comments on commit e1c8a57

Please sign in to comment.