Add manual catalog management

This commit is contained in:
2026-04-14 18:24:49 +08:00
parent 0c01b91fd7
commit 89bdf2ff61
7 changed files with 1062 additions and 15 deletions
+4 -1
View File
@@ -9,6 +9,7 @@ from pathlib import Path
from typing import Iterable
from device_mapper import (
MANUAL_SOURCE_FILE,
MARKET_BRAND_ALIASES,
MARKET_BRAND_TO_MANUFACTURER,
build_records,
@@ -28,9 +29,11 @@ def is_cn_source_file(source_file: str) -> bool:
def build_source_order(records: list[object]) -> list[str]:
source_files = sorted({record.source_file for record in records})
manual = [source for source in source_files if source == MANUAL_SOURCE_FILE]
source_files = [source for source in source_files if source != MANUAL_SOURCE_FILE]
cn = [source for source in source_files if is_cn_source_file(source)]
other = [source for source in source_files if not is_cn_source_file(source)]
return sorted(cn) + sorted(other)
return manual + sorted(cn) + sorted(other)
def build_source_weights(records: list[object]) -> tuple[dict[str, int], dict[str, float]]: