Skip to content

Commit 589736f

Browse files
committed
feat: update manifest with model details and adjust filename regex in registry script
1 parent 357c9fb commit 589736f

File tree

2 files changed

+46
-10
lines changed

2 files changed

+46
-10
lines changed

magic/manifest.json

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,40 @@
1-
{
2-
"models": []
1+
{
2+
"models": [
3+
{
4+
"name": "Luma",
5+
"version": "081519D",
6+
"author": "Papillon",
7+
"date_created": "2025-08-15",
8+
"parameters": {
9+
"oovIndex": 1,
10+
"maxLen": 128
11+
},
12+
"compatible_versions": [
13+
">=8.0.0"
14+
],
15+
"size_bytes": 342,
16+
"sha256": "6a314fa9e23da548b2a597cef80c224e75a865dfb96d572b5076ac1eef373311",
17+
"download_url": "https://raw.githubusercontent.com/owner/repo/main/magic/upload/Luma_081539D.magic",
18+
"build_id": "081539D",
19+
"build_type": "alpha"
20+
},
21+
{
22+
"name": "Luma",
23+
"version": "081549F",
24+
"author": "Papillon",
25+
"date_created": "2025-08-15",
26+
"parameters": {
27+
"oovIndex": 1,
28+
"maxLen": 128
29+
},
30+
"compatible_versions": [
31+
">8.0.0"
32+
],
33+
"size_bytes": 1673086,
34+
"sha256": "f1016c28499fb396dc25799c781b0e4f490e46c9eef4fc6e3fe00df9f4c95152",
35+
"download_url": "https://raw.githubusercontent.com/owner/repo/main/magic/upload/Luma_081599F.magic",
36+
"build_id": "081599F",
37+
"build_type": "debug"
38+
}
39+
]
340
}

scripts/update_registry.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"F": "debug",
1818
}
1919

20-
FILENAME_RE = re.compile(r"^(?P<name>[^_]+)_(?P<version>[^_]+)_(?P<buildid>[A-Za-z0-9]+)\.magic$")
20+
FILENAME_RE = re.compile(r"^(?P<name>[^_]+)_(?P<buildid>[A-Za-z0-9]+)\.magic$")
2121

2222
def sha256_file(path: Path) -> str:
2323
h = hashlib.sha256()
@@ -27,20 +27,20 @@ def sha256_file(path: Path) -> str:
2727
return h.hexdigest()
2828

2929
def parse_build_type(build_id: str) -> str:
30-
if len(build_id) >= 3:
31-
letter = build_id[2].upper()
30+
if build_id:
31+
letter = build_id[-1].upper()
3232
return BUILD_MAP.get(letter, "unknown")
3333
return "unknown"
3434

3535
def read_model_infos_from_magic(magic_path: Path) -> dict:
3636
with zipfile.ZipFile(magic_path, "r") as z:
3737
candidate = None
3838
for name in z.namelist():
39-
if name.lower().endswith("infos.json"):
39+
if name.lower().endswith("metadata.json"):
4040
candidate = name
4141
break
4242
if not candidate:
43-
raise FileNotFoundError(f"Aucun infos.json dans {magic_path.name}")
43+
raise FileNotFoundError(f"Aucun metadata.json dans {magic_path.name}")
4444

4545
with z.open(candidate) as f:
4646
data = json.loads(f.read().decode("utf-8"))
@@ -100,15 +100,14 @@ def main():
100100
continue
101101

102102
name = m.group("name")
103-
version = m.group("version")
104103
build_id = m.group("buildid")
105-
build_type = parse_build_type(build_id)
106-
107104
try:
108105
infos = read_model_infos_from_magic(magic_path)
109106
except Exception as e:
110107
print(f"[ERREUR] {magic_path.name}: {e}")
111108
continue
109+
version = infos.get("version", "unknown")
110+
build_type = parse_build_type(build_id)
112111

113112
if infos.get("version") and infos["version"] != version:
114113
print(f"[WARN] version mismatch: filename={version} / infos.json={infos['version']}")

0 commit comments

Comments
 (0)