[WORK] Скан скрытых функций: 29 устройств × 29 функций с цитатами; CLS120 тоже Dante; HDBaseT/AVB = 0 (честный ответ)
This commit is contained in:
1 parent
6b3adc7266
commit
0962104843
4 files changed
+388
-1
No files matched your search
@@ -0,0 +1,110 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Скан даташитов на «скрытые» функции: Dante, AES67, AEC, HDBaseT, PoE, USB-C и др.
|
||||
|
||||
Для каждой функции сохраняется цитата-доказательство из даташита.
|
||||
Выход: protocols.yaml (устройство -> {функция: цитата}).
|
||||
"""
|
||||
import glob
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
|
||||
BASE = "/opt/work-hub/compat"
|
||||
|
||||
# ключ: (название для фильтра, паттерн поиска)
|
||||
FEATURES = {
|
||||
"Dante": (r"\bdante\b", None),
|
||||
"AES67": (r"aes\s*-?\s*67", None),
|
||||
"AEC": (r"\bAEC\b|acoustic echo cancellation", None),
|
||||
"ANC": (r"\bANC\b|active noise cancellation|noise suppression", None),
|
||||
"HDBaseT": (r"hd\s*base\s*t", None),
|
||||
"PoE": (r"\bPoE\b|802\.3af|802\.3at|802\.3bt", None),
|
||||
"USB-C": (r"USB[-\s]?C", None),
|
||||
"H.323": (r"H\.323", None),
|
||||
"SIP": (r"\bSIP\b", None),
|
||||
"Bluetooth": (r"bluetooth", None),
|
||||
"Wi-Fi": (r"wi-?fi", None),
|
||||
"4K": (r"\b4K\b", None),
|
||||
"Zoom (сервис)": (r"Zoom Rooms|native Zoom", None),
|
||||
"Teams": (r"Microsoft Teams|Teams Rooms", None),
|
||||
"AirPlay": (r"airplay", None),
|
||||
"Miracast": (r"miracast", None),
|
||||
"Presenter Tracking": (r"presenter tracking", None),
|
||||
"Auto Framing": (r"auto[\s-]framing", None),
|
||||
"Speaker Tracking": (r"speaker tracking", None),
|
||||
"IntelliFrame": (r"intelliframe", None),
|
||||
"SRTP": (r"SRTP", None),
|
||||
"TLS": (r"\bTLS\b", None),
|
||||
"802.1X": (r"802\.1X", None),
|
||||
"LLDP": (r"LLDP", None),
|
||||
"VLAN": (r"VLAN", None),
|
||||
"AVB": (r"\bAVB\b", None),
|
||||
"Q-SYS/QSC": (r"QSC", None),
|
||||
"Shure": (r"shure", None),
|
||||
"Biamp": (r"biamp", None),
|
||||
}
|
||||
|
||||
|
||||
def fix(s):
|
||||
return "" if s is None else str(s)
|
||||
|
||||
|
||||
def main():
|
||||
import yaml
|
||||
files = glob.glob("/opt/work-hub/devices/yealink/*.yaml")
|
||||
print("даташитов:", len(files))
|
||||
out = {}
|
||||
stat = {k: 0 for k in FEATURES}
|
||||
for f in files:
|
||||
try:
|
||||
d = yaml.safe_load(open(f, encoding="utf-8"))["device"]
|
||||
except Exception:
|
||||
continue
|
||||
model = re.sub(r"\s*\(\d+\)?\s*$", "", d.get("model") or "").strip()
|
||||
lines = []
|
||||
for k, vals in (d.get("specs") or {}).items():
|
||||
lines += ["%s: %s" % (k, v) for v in vals]
|
||||
blob = "\n".join(lines)
|
||||
found = {}
|
||||
for key, (pat, _) in FEATURES.items():
|
||||
m = re.search(pat, blob, re.I)
|
||||
if not m:
|
||||
continue
|
||||
# цитата: строка с совпадением
|
||||
quote = ""
|
||||
for ln in lines:
|
||||
if re.search(pat, ln, re.I):
|
||||
quote = re.sub(r"\s+", " ", ln)[:160]
|
||||
break
|
||||
found[key] = quote or m.group(0)
|
||||
stat[key] += 1
|
||||
if found:
|
||||
if model in out:
|
||||
for k, v in found.items():
|
||||
out[model].setdefault(k, v)
|
||||
else:
|
||||
out[model] = found
|
||||
|
||||
path = os.path.join(BASE, "protocols.yaml")
|
||||
with open(path, "w", encoding="utf-8") as f:
|
||||
yaml.safe_dump({"vendor": "yealink",
|
||||
"source": "даташиты support.yealink.com (regex по спецификациям)",
|
||||
"devices": [{"device": k, "features": v}
|
||||
for k, v in sorted(out.items())]},
|
||||
f, allow_unicode=True, sort_keys=False, width=200)
|
||||
|
||||
print("устройств с функциями: %d" % len(out))
|
||||
print("\nраспространённость функций:")
|
||||
for k, n in sorted(stat.items(), key=lambda x: -x[1]):
|
||||
if n:
|
||||
print(" %-20s %2d устройств" % (k, n))
|
||||
|
||||
# ключевые проверки
|
||||
for key in ("Dante", "AES67", "HDBaseT", "AVB"):
|
||||
devs = [d for d, v in out.items() if key in v]
|
||||
print("\n%s (%d): %s" % (key, len(devs), ", ".join(sorted(devs)[:10]) or "—"))
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
Reference in new issue
Block a user