-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
update.py
165 lines (155 loc) · 6.19 KB
/
update.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
import logging
from altparse import AltSourceManager, Parser, altsource_from_file
logging.basicConfig(level=logging.INFO, format="%(levelname)s: %(message)s")
sourcesData = [
{
"parser": Parser.ALTSOURCE,
"kwargs": {"filepath": "https://quarksources.github.io/quarksource.json"},
"ids": ["com.louisanslow.record", "org.scummvm.scummvm"]
},
{
"parser": Parser.ALTSOURCE,
"kwargs": {"filepath": "https://raw.githubusercontent.com/SideStore/Community-Source/main/staticApps/play.json"},
"ids": ["com.virtualapplications.play"]
},
{
"parser": Parser.ALTSOURCE,
"kwargs": {"filepath": "https://raw.githubusercontent.com/SideStore/Community-Source/main/staticApps/Retroarch.json"},
"ids": ["com.libretro.RetroArchiOS11"]
},
{
"parser": Parser.GITHUB,
"kwargs": {"repo_author": "iNDS-Team", "repo_name": "iNDS"},
"ids": ["net.nerd.iNDS"]
},
{
"parser": Parser.GITHUB,
"kwargs": {"repo_author": "yoshisuga", "repo_name": "MAME4iOS"},
"ids": ["com.example.mame4ios"]
},
{
"parser": Parser.ALTSOURCE,
"kwargs": {"filepath": "https://ish.app/altstore.json"},
"ids": ["app.ish.iSH"],
"getAllNews": True
},
{
"parser": Parser.GITHUB,
"kwargs": {"repo_author": "nspire-emus", "repo_name": "firebird"},
"ids": ["com.firebird.firebird-emu"]
},
{
"parser": Parser.GITHUB,
"kwargs": {"repo_author": "Wh0ba", "repo_name": "XPatcher"},
"ids": ["com.wh0ba.xpatcher"]
},
{
"parser": Parser.GITHUB,
"kwargs": {"repo_author": "litchie", "repo_name": "dospad"},
"ids": ["com.litchie.idosgames"]
},
{
"parser": Parser.GITHUB,
"kwargs": {"repo_author": "QuarkSources", "repo_name": "ppsspp-builder"},
"ids": ["org.ppsspp.ppsspp"]
},
{
"parser": Parser.UNC0VER,
"kwargs": {"url": "https://unc0ver.dev/releases.json"},
"ids": ["science.xnu.undecimus"]
},
{
"parser": Parser.GITHUB,
"kwargs": {"repo_author": "zydeco", "repo_name": "minivmac4ios"},
## This is the previous kwargs required when this application was distributed as a zipped .ipa file ##
## "kwargs": {"repo_author": "zydeco", "repo_name": "minivmac4ios", "asset_regex": r".*\.ipa\.zip", "extract_twice": True, "upload_ipa_repo": g_release},
"ids": ["net.namedfork.minivmac"]
},
{
"parser": Parser.GITHUB,
"kwargs": {"repo_author": "T-Pau", "repo_name": "Ready", "ver_parse": lambda x: x.replace("release-", "")},
"ids": ["at.spiderlab.c64"]
},
{
"parser": Parser.GITHUB,
"kwargs": {"repo_author": "yoshisuga", "repo_name": "activegs-ios"},
"ids": ["com.yoshisuga.activeGS"]
},
{
"parser": Parser.GITHUB,
"kwargs": {"repo_author": "zzanehip", "repo_name": "The-OldOS-Project"},
"ids": ["com.zurac.OldOS"]
},
{
"parser": Parser.ALTSOURCE,
"kwargs": {"filepath": "https://gitlab.com/blurt/openblurt/blurt-mobile-app/-/raw/main/ios/app.json"},
"ids": ["blog.blurt.blurt"],
"getAllNews": True
},
{
"parser": Parser.ALTSOURCE,
"kwargs": {"filepath": "https://github.com/spknetwork/Android-App/raw/development/ios/app.json"},
"ids": ["com.example.acela"],
"getAllNews": True
},
{
"parser": Parser.ALTSOURCE,
"kwargs": {"filepath": "https://raw.githubusercontent.com/vcmi/vcmi-updates/master/altstore/altstore.json"},
"ids": ["eu.vcmi.vcmiclient"],
"getAllNews": True
}
]
alternateAppData = {
"com.firebird.firebird-emu": {
"screenshotURLs": [
"https://user-images.githubusercontent.com/64176728/211237020-f12974b6-5836-4bf1-a927-002f9e48a00f.png",
"https://user-images.githubusercontent.com/64176728/211237030-6c613bae-3a5e-4826-9fd6-20dfa628bd4a.png",
"https://user-images.githubusercontent.com/64176728/211237032-e8a72501-9c94-4d5f-b50c-ea65ef84c361.png"
]
},
"app.ish.iSH": {
"screenshotURLs": [
"https://ish.app/assets/front-iphone-full.png",
"https://user-images.githubusercontent.com/64176728/216813647-1f660131-b5fe-4951-b46b-44fcfad0c2f2.png"
]
},
"net.namedfork.minivmac": {
"screenshotURLs": [
"https://user-images.githubusercontent.com/64176728/211237407-e79d6562-c6c2-4a69-b8ea-4414e6b97be0.png",
"https://user-images.githubusercontent.com/64176728/211237433-ca07c970-747e-4fd1-a206-be07384183cb.png",
"https://user-images.githubusercontent.com/64176728/211237435-27c3a84c-7213-4a55-b4d9-b7a9362ffb36.png"
]
}
#"eu.pokemmo.client": {
# "beta": False
#}
#"com.virtualapplications.play": {
# "screenshotURLs": [
# "https://user-images.githubusercontent.com/64176728/209461585-74b856e0-ae30-41be-91ce-d3eb262be260.png",
# "https://user-images.githubusercontent.com/64176728/209461763-c122f9f6-5103-4c59-b730-0e5b34b5937b.png",
# "https://user-images.githubusercontent.com/64176728/209461593-f771a49d-a44d-4d9c-8bb7-dfab48c5dd25.png"
# ]
#}
}
def header_remover(filename: str, header: str):
with open(filename, 'r+') as f:
content = f.readlines()
f.seek(0)
f.writelines(content[header.count('\n')+1:])
f.truncate()
def header_prepender(filename: str, header: str):
with open(filename, 'r+') as f:
content = f.read()
f.seek(0, 0)
f.write(header.rstrip('\r\n') + '\n' + content)
f.truncate()
src = altsource_from_file("sidecommunity.json")
mgr = AltSourceManager(src, sourcesData)
try:
mgr.update()
mgr.alter_app_info(alternateAppData)
mgr.save(prettify=True,only_standard_props=False)
#mgr.save("sidecommunity.min.json",prettify=False) # use to save an additional copy of the json except minified
except Exception as err:
logging.error(f"Unable to update {mgr.src.name}.")
logging.error(f"{type(err).__name__}: {str(err)}")