MCPcopy
hub / github.com/pluwen/awesome-testflight-link / update_all_links

Function update_all_links

scripts/update_status.py:61–104  ·  view source on GitHub ↗

更新所有链接的状态,并补全缺失的应用名称

(links_data)

Source from the content-addressed store, hash-verified

59 return (key, current_status, app_name)
60
61async def update_all_links(links_data):
62 """更新所有链接的状态,并补全缺失的应用名称"""
63 print(f"[info] Updating all links...")
64 all_links = links_data.get("_links", {})
65 links = list(all_links.keys())
66
67 if not links:
68 print("[warn] No links found")
69 return
70
71 conn_config = aiohttp.TCPConnector(limit=5, limit_per_host=2)
72 async with aiohttp.ClientSession(base_url=BASE_URL, connector=conn_config) as session:
73 tasks = [
74 check_status(session, link, all_links[link].get('status', 'N'), all_links[link].get('app_name'))
75 for link in links
76 ]
77 results = await asyncio.gather(*tasks)
78
79 updated_count = 0
80
81 for link, status, app_name in results:
82 if link not in all_links:
83 continue
84
85 link_info = all_links[link]
86 changed = False
87
88 if link_info.get('status') != status:
89 link_info['status'] = status
90 link_info['last_modify'] = TODAY
91 changed = True
92
93 # 补全缺失/占位的应用名称
94 if app_name and app_name not in MISSING_NAMES:
95 old_name = link_info.get('app_name')
96 if not old_name or old_name in MISSING_NAMES:
97 link_info['app_name'] = app_name
98 changed = True
99 print(f"[info] {link} - filled app name: '{old_name}' → '{app_name}'")
100
101 if changed:
102 updated_count += 1
103
104 print(f"[info] Status updated: {updated_count}")
105
106async def main():
107 links_data = load_links()

Callers 1

mainFunction · 0.85

Calls 1

check_statusFunction · 0.70

Tested by

no test coverage detected