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

Function generate_platform_section

scripts/utils.py:30–85  ·  view source on GitHub ↗

从 links.json 直接生成平台部分的 markdown 内容

(table_name, links_data)

Source from the content-addressed store, hash-verified

28
29
30def generate_platform_section(table_name, links_data):
31 """从 links.json 直接生成平台部分的 markdown 内容"""
32 all_links = links_data.get("_links", {})
33
34 # 获取该平台的所有应用
35 table_links = {
36 link_id: info for link_id, info in all_links.items()
37 if table_name in info.get("tables", [])
38 }
39
40 if not table_links:
41 return ""
42
43 markdown = []
44
45 for status_code in ['Y', 'F', 'N', 'D']:
46 # 按状态过滤和排序应用
47 apps = sorted(
48 [
49 {
50 'app_name': info['app_name'],
51 'testflight_link': link_id,
52 'status': info['status'],
53 'last_modify': info['last_modify']
54 }
55 for link_id, info in table_links.items()
56 if info['status'] == status_code
57 ],
58 key=lambda x: x['app_name'].lower()
59 )
60
61 if not apps:
62 continue
63
64 status_data = STATUS_INFO[status_code]
65 app_count = len(apps)
66
67 # 生成分类
68 markdown.append(f"<details {'open' if status_code == 'Y' else ''}>\n")
69 markdown.append(f"<summary><strong>{status_data['name']} ({app_count} app{'s' if app_count != 1 else ''})</strong> - {status_data['description']}</summary>\n\n")
70
71 if status_code == 'Y':
72 markdown.append(f"_✅ These {app_count} apps are currently accepting new testers! Click the links to join._\n\n")
73 elif status_code == 'F':
74 markdown.append(f"_⚠️ These {app_count} apps have reached their tester limit. Try checking back later._\n\n")
75
76 markdown.append("| Name | TestFlight Link | Status | Last Updated |\n")
77 markdown.append("| --- | --- | --- | --- |\n")
78
79 for app in apps:
80 full_link = f"https://testflight.apple.com/join/{app['testflight_link']}"
81 markdown.append(f"| {app['app_name']} | [{full_link}]({full_link}) | {app['status']} | {app['last_modify']} |\n")
82
83 markdown.append("\n</details>\n\n")
84
85 return "".join(markdown)
86
87def renew_readme():

Callers 1

renew_readmeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected