Skip to content

Commit

Permalink
Merge pull request #649 from Guovin/dev
Browse files Browse the repository at this point in the history
Fix
  • Loading branch information
Guovin authored Dec 11, 2024
2 parents 9f399b6 + bd6a7c6 commit 9844ea3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
Empty file.
24 changes: 13 additions & 11 deletions utils/speed.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,16 @@ def sort_urls_by_speed_and_resolution(name, data, logger=None):
"""
filter_data = []
for url, date, resolution, origin in data:
result = {
"url": url,
"date": date,
"delay": None,
"speed": None,
"resolution": resolution,
"origin": origin
}
if origin == "important":
filter_data.append((url, date, resolution, origin))
filter_data.append(result)
continue
cache_key_match = re.search(r"cache:(.*)", url.partition("$")[2])
cache_key = cache_key_match.group(1) if cache_key_match else None
Expand All @@ -267,16 +275,10 @@ def sort_urls_by_speed_and_resolution(name, data, logger=None):
)
except Exception as e:
print(e)
filter_data.append(
{
"url": url,
"date": date,
"delay": delay,
"speed": speed,
"resolution": resolution,
"origin": origin
}
)
result["delay"] = delay
result["speed"] = speed
result["resolution"] = resolution
filter_data.append(result)

def combined_key(item):
speed, delay, resolution, origin = item["speed"], item["delay"], item["resolution"], item["origin"]
Expand Down

0 comments on commit 9844ea3

Please sign in to comment.