Add OUI database (MAC prefix to brand mapping, 2405 entries)

This commit is contained in:
eduard256
2026-03-25 06:20:41 +00:00
parent 40f5c7830c
commit cce1b99663
3 changed files with 2430 additions and 0 deletions
+1
View File
@@ -6,6 +6,7 @@ on:
paths:
- "brands/**"
- "presets/**"
- "oui.json"
- "scripts/build_sqlite.py"
- "scripts/generate_presets.py"
- ".github/workflows/build.yml"
+2407
View File
File diff suppressed because it is too large Load Diff
+22
View File
@@ -20,6 +20,7 @@ import time
BRANDS_DIR = os.path.join(os.path.dirname(__file__), "..", "brands")
PRESETS_DIR = os.path.join(os.path.dirname(__file__), "..", "presets")
OUI_FILE = os.path.join(os.path.dirname(__file__), "..", "oui.json")
SCHEMA = """
-- Database metadata
@@ -74,6 +75,12 @@ CREATE TABLE preset_streams (
FOREIGN KEY (preset_id) REFERENCES presets(preset_id)
);
-- OUI (MAC prefix to brand mapping)
CREATE TABLE oui (
prefix TEXT PRIMARY KEY,
brand TEXT NOT NULL
);
-- Indexes for fast lookups
CREATE INDEX idx_streams_brand_id ON streams(brand_id);
CREATE INDEX idx_streams_protocol ON streams(protocol);
@@ -201,6 +208,19 @@ def build(output_path):
)
preset_stream_count += 1
# Insert OUI data
oui_count = 0
oui_file = os.path.abspath(OUI_FILE)
if os.path.exists(oui_file):
with open(oui_file) as f:
oui_data = json.load(f)
for prefix, brand in oui_data.items():
conn.execute(
"INSERT OR IGNORE INTO oui (prefix, brand) VALUES (?, ?)",
(prefix, brand),
)
oui_count += 1
# Insert metadata
elapsed = time.time() - start
conn.execute("INSERT INTO meta VALUES ('version', '2')")
@@ -208,6 +228,7 @@ def build(output_path):
conn.execute(f"INSERT INTO meta VALUES ('brands', '{brand_count}')")
conn.execute(f"INSERT INTO meta VALUES ('streams', '{stream_count}')")
conn.execute(f"INSERT INTO meta VALUES ('presets', '{preset_count}')")
conn.execute(f"INSERT INTO meta VALUES ('oui', '{oui_count}')")
conn.commit()
@@ -230,6 +251,7 @@ def build(output_path):
print(f" Model refs: {model_ref_count}")
print(f" Presets: {preset_count}")
print(f" Preset streams: {preset_stream_count}")
print(f" OUI entries: {oui_count}")
print(f" Build time: {elapsed:.2f}s")