mirror of
https://github.com/seanbetts/steam-hardware-watch.git
synced 2026-10-06 03:00:18 +02:00
Fix SteamTracking freshness and hardware signals
This commit is contained in:
1 parent
c306b67472
commit
98f9a51171
8 files changed
+411
-2
No files matched your search
@@ -17,6 +17,46 @@ if [ ! -d "$TRACKING_DIR" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
SOURCE_REPORT="$OUT_DIR/steamtracking-source.txt"
|
||||
|
||||
if [ -d "$TRACKING_DIR/.git" ]; then
|
||||
if ! git -C "$TRACKING_DIR" rev-parse --is-inside-work-tree >/dev/null 2>&1; then
|
||||
echo "invalid SteamTracking git checkout: $TRACKING_DIR" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
BEFORE_COMMIT="$(git -C "$TRACKING_DIR" rev-parse HEAD)"
|
||||
BEFORE_TIME="$(git -C "$TRACKING_DIR" log -1 --format=%cI)"
|
||||
if [ "${STEAMTRACKING_UPDATE:-1}" = "1" ]; then
|
||||
BRANCH="$(git -C "$TRACKING_DIR" rev-parse --abbrev-ref HEAD)"
|
||||
if [ "$BRANCH" = "HEAD" ]; then
|
||||
git -C "$TRACKING_DIR" fetch --prune --quiet
|
||||
else
|
||||
git -C "$TRACKING_DIR" pull --ff-only --quiet
|
||||
fi
|
||||
fi
|
||||
AFTER_COMMIT="$(git -C "$TRACKING_DIR" rev-parse HEAD)"
|
||||
AFTER_TIME="$(git -C "$TRACKING_DIR" log -1 --format=%cI)"
|
||||
{
|
||||
printf 'tracking_dir=%s\n' "$TRACKING_DIR"
|
||||
printf 'before_commit=%s\n' "$BEFORE_COMMIT"
|
||||
printf 'before_time=%s\n' "$BEFORE_TIME"
|
||||
printf 'after_commit=%s\n' "$AFTER_COMMIT"
|
||||
printf 'after_time=%s\n' "$AFTER_TIME"
|
||||
printf 'updated=%s\n' "$([ "$BEFORE_COMMIT" = "$AFTER_COMMIT" ] && printf no || printf yes)"
|
||||
} > "$SOURCE_REPORT"
|
||||
else
|
||||
{
|
||||
printf 'tracking_dir=%s\n' "$TRACKING_DIR"
|
||||
printf 'git_checkout=no\n'
|
||||
} > "$SOURCE_REPORT"
|
||||
fi
|
||||
|
||||
if [ ! -d "$TRACKING_DIR/ClientManifest" ] && [ ! -d "$TRACKING_DIR/ClientExtracted" ]; then
|
||||
echo "SteamTracking checkout has no ClientManifest or ClientExtracted content: $TRACKING_DIR" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
rg -n -i "Triton|Ibex|Puck|Steam Controller|firmware|pair|dock|dongle" \
|
||||
"$TRACKING_DIR" \
|
||||
> "$OUT_DIR/steamtracking-hits.txt" || true
|
||||
@@ -29,7 +69,13 @@ python3 "$SCRIPT_DIR/parse_steamtracking_client_manifests.py" \
|
||||
--run-dir "$RUN_DIR" \
|
||||
--tracking-dir "$TRACKING_DIR"
|
||||
|
||||
python3 "$SCRIPT_DIR/parse_steamtracking_hardware_signals.py" \
|
||||
--run-dir "$RUN_DIR" \
|
||||
--tracking-dir "$TRACKING_DIR"
|
||||
|
||||
printf '%s\n' \
|
||||
"Saved SteamTracking source metadata to $SOURCE_REPORT" \
|
||||
"Saved SteamTracking grep output to $OUT_DIR/steamtracking-hits.txt" \
|
||||
"Saved pairing-focused grep output to $OUT_DIR/steamtracking-pairing-focus.txt" \
|
||||
"Saved client manifest report to $OUT_DIR/steamtracking-client-manifests.md"
|
||||
"Saved client manifest report to $OUT_DIR/steamtracking-client-manifests.md" \
|
||||
"Saved hardware signal report to $OUT_DIR/steamtracking-hardware-signals.md"
|
||||
@@ -124,6 +124,8 @@ def build_summary(prev_dir: Path, curr_dir: Path):
|
||||
deltas.extend(compare_report_sets(prev_dir, curr_dir, "Komodo frame media", "komodo-frame-media.tsv"))
|
||||
deltas.extend(compare_text_lines(prev_dir, curr_dir, "SteamKit/PICS", "steamkit-pics-key-lines.txt"))
|
||||
deltas.extend(compare_text_lines(prev_dir, curr_dir, "SteamDB", "steamdb-key-lines.txt"))
|
||||
deltas.extend(compare_text_lines(prev_dir, curr_dir, "SteamTracking source", "steamtracking-source.txt"))
|
||||
deltas.extend(compare_text_lines(prev_dir, curr_dir, "SteamTracking hardware signals", "steamtracking-hardware-signals-key-lines.txt"))
|
||||
deltas.extend(compare_text_lines(prev_dir, curr_dir, "Steam client manifests", "steamtracking-client-manifests-key-lines.txt"))
|
||||
deltas.extend(compare_text_lines(prev_dir, curr_dir, "SteamVR depots", "steamvr-depots-key-lines.txt"))
|
||||
deltas.extend(compare_text_lines(prev_dir, curr_dir, "SteamOS mirror", "steamos-mirror-key-lines.txt"))
|
||||
|
||||
@@ -50,6 +50,9 @@ def build_draft(run_dir: Path):
|
||||
steamdb_lines = first_n_nonempty(reports / "steamdb-key-lines.txt", 8)
|
||||
valve_lines = first_n_nonempty(reports / "valve-key-lines.txt", 8)
|
||||
tracking_lines = first_n_nonempty(reports / "steamtracking-pairing-focus.txt", 8)
|
||||
hardware_signal_lines = first_n_nonempty(
|
||||
reports / "steamtracking-hardware-signals-key-lines.txt", 8
|
||||
)
|
||||
client_manifest_lines = first_n_nonempty(
|
||||
reports / "steamtracking-client-manifests-key-lines.txt", 8
|
||||
)
|
||||
@@ -130,6 +133,9 @@ def build_draft(run_dir: Path):
|
||||
lines.extend([f"- `{line}`" for line in tracking_lines])
|
||||
else:
|
||||
lines.append("- No focused SteamTracking report found.")
|
||||
if hardware_signal_lines:
|
||||
lines.extend(["", "Steam hardware backend signal focus:"])
|
||||
lines.extend([f"- `{line}`" for line in hardware_signal_lines])
|
||||
if client_manifest_lines:
|
||||
lines.extend(["", "Steam client manifest focus:"])
|
||||
lines.extend([f"- `{line}`" for line in client_manifest_lines])
|
||||
|
||||
+155
@@ -0,0 +1,155 @@
|
||||
#!/usr/bin/env python3
|
||||
import argparse
|
||||
import csv
|
||||
import re
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
SEARCH_ROOTS = (
|
||||
"ClientExtracted",
|
||||
"ClientManifest",
|
||||
"Protobufs",
|
||||
"ProtobufsWebui",
|
||||
"Random",
|
||||
"Strings",
|
||||
"c/ClientExtracted",
|
||||
)
|
||||
|
||||
SKIP_SUFFIXES = {
|
||||
".avif",
|
||||
".bmp",
|
||||
".gif",
|
||||
".gz",
|
||||
".jpg",
|
||||
".jpeg",
|
||||
".mp4",
|
||||
".png",
|
||||
".webm",
|
||||
".zip",
|
||||
}
|
||||
|
||||
HARDWARE_RE = re.compile(
|
||||
r"Steam\s*Machine|SteamMachine|k_ESteamMachine|Steam\s*Frame|SteamFrame|k_ESteamFrame|"
|
||||
r"Steam\s*Controller|Triton|Ibex|Puck|Fremont|Deckard|Roy|"
|
||||
r"4165910|4165890|1629446|1629447|1629458|1629460|1629484|1629486",
|
||||
re.IGNORECASE,
|
||||
)
|
||||
|
||||
SIGNAL_RE = re.compile(
|
||||
r"GuidedTour|WelcomeTour|Welcome|Tour|OOBE|onboarding|first.run|reservation|reserve|"
|
||||
r"preorder|pre-order|purchase|availability|microSD|SDCard|compatibility|verified|"
|
||||
r"pair|firmware|dongle|adapter|package|manifest",
|
||||
re.IGNORECASE,
|
||||
)
|
||||
|
||||
|
||||
def iter_files(tracking_dir: Path):
|
||||
for root in SEARCH_ROOTS:
|
||||
base = tracking_dir / root
|
||||
if not base.exists():
|
||||
continue
|
||||
if base.is_file():
|
||||
yield base
|
||||
continue
|
||||
for path in base.rglob("*"):
|
||||
if not path.is_file():
|
||||
continue
|
||||
if path.suffix.lower() in SKIP_SUFFIXES:
|
||||
continue
|
||||
yield path
|
||||
|
||||
|
||||
def classify(line: str):
|
||||
hardware = HARDWARE_RE.search(line)
|
||||
signal = SIGNAL_RE.search(line)
|
||||
if not hardware or not signal:
|
||||
return ""
|
||||
if re.search(r"GuidedTour|Welcome|Tour|OOBE|onboarding", line, re.IGNORECASE):
|
||||
return "setup-tour"
|
||||
if re.search(r"reservation|reserve|preorder|pre-order|purchase|availability|package", line, re.IGNORECASE):
|
||||
return "commerce"
|
||||
if re.search(r"pair|firmware|dongle|adapter|Triton|Ibex|Puck", line, re.IGNORECASE):
|
||||
return "controller"
|
||||
if re.search(r"compatibility|verified", line, re.IGNORECASE):
|
||||
return "compatibility"
|
||||
return "hardware"
|
||||
|
||||
|
||||
def build_rows(tracking_dir: Path):
|
||||
rows = []
|
||||
for path in iter_files(tracking_dir):
|
||||
try:
|
||||
text = path.read_text(encoding="utf-8", errors="ignore")
|
||||
except OSError:
|
||||
continue
|
||||
rel_path = path.relative_to(tracking_dir).as_posix()
|
||||
for line_number, line in enumerate(text.splitlines(), start=1):
|
||||
category = classify(line)
|
||||
if not category:
|
||||
continue
|
||||
rows.append(
|
||||
{
|
||||
"category": category,
|
||||
"path": rel_path,
|
||||
"line": str(line_number),
|
||||
"text": line.strip(),
|
||||
}
|
||||
)
|
||||
return rows
|
||||
|
||||
|
||||
def write_tsv(rows, path: Path):
|
||||
path.parent.mkdir(parents=True, exist_ok=True)
|
||||
with path.open("w", encoding="utf-8", newline="") as handle:
|
||||
writer = csv.DictWriter(handle, fieldnames=("category", "path", "line", "text"), delimiter="\t")
|
||||
writer.writeheader()
|
||||
writer.writerows(rows)
|
||||
|
||||
|
||||
def write_key_lines(rows, path: Path):
|
||||
lines = []
|
||||
seen = set()
|
||||
for row in rows:
|
||||
line = f"{row['category']}\t{row['path']}:{row['line']}\t{row['text']}"
|
||||
if line in seen:
|
||||
continue
|
||||
seen.add(line)
|
||||
lines.append(line)
|
||||
path.parent.mkdir(parents=True, exist_ok=True)
|
||||
path.write_text("\n".join(lines) + ("\n" if lines else ""), encoding="utf-8")
|
||||
|
||||
|
||||
def write_markdown(rows, path: Path):
|
||||
lines = [
|
||||
"# SteamTracking Hardware Signals",
|
||||
"",
|
||||
"Focused SteamTracking scan for Valve hardware setup, commerce, compatibility, and controller backend signals.",
|
||||
"",
|
||||
"| Category | Source | Text |",
|
||||
"| --- | --- | --- |",
|
||||
]
|
||||
for row in rows[:200]:
|
||||
text = row["text"].replace("|", "\\|")
|
||||
lines.append(f"| {row['category']} | `{row['path']}:{row['line']}` | `{text}` |")
|
||||
if len(rows) > 200:
|
||||
lines.extend(["", f"_Truncated markdown table to first 200 of {len(rows)} matches._"])
|
||||
path.parent.mkdir(parents=True, exist_ok=True)
|
||||
path.write_text("\n".join(lines) + "\n", encoding="utf-8")
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("--run-dir", required=True, type=Path)
|
||||
parser.add_argument("--tracking-dir", required=True, type=Path)
|
||||
args = parser.parse_args()
|
||||
|
||||
reports = args.run_dir / "reports"
|
||||
rows = build_rows(args.tracking_dir)
|
||||
rows.sort(key=lambda row: (row["category"], row["path"], int(row["line"]), row["text"]))
|
||||
write_tsv(rows, reports / "steamtracking-hardware-signals.tsv")
|
||||
write_key_lines(rows, reports / "steamtracking-hardware-signals-key-lines.txt")
|
||||
write_markdown(rows, reports / "steamtracking-hardware-signals.md")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -22,6 +22,12 @@ FILTER_TERMS = (
|
||||
"xr",
|
||||
"vr",
|
||||
"dongle",
|
||||
"guidedtour",
|
||||
"welcome",
|
||||
"tour",
|
||||
"oobe",
|
||||
"sdcard",
|
||||
"microsd",
|
||||
)
|
||||
REJECT_TERMS = (
|
||||
"application_config",
|
||||
@@ -153,6 +159,7 @@ def build(run_dir: Path):
|
||||
notable.extend([f"- SteamKit/PICS: `{line}`" for line in filtered_first(reports / "steamkit-pics-key-lines.txt", 8)])
|
||||
notable.extend([f"- SteamDB: `{line}`" for line in filtered_first(reports / "steamdb-key-lines.txt", 5)])
|
||||
notable.extend([f"- SteamTracking: `{line}`" for line in filtered_first(reports / "steamtracking-pairing-focus.txt", 5)])
|
||||
notable.extend([f"- SteamTracking hardware: `{line}`" for line in filtered_first(reports / "steamtracking-hardware-signals-key-lines.txt", 8)])
|
||||
notable.extend([f"- Steam client manifests: `{line}`" for line in filtered_first(reports / "steamtracking-client-manifests-key-lines.txt", 8)])
|
||||
notable.extend([f"- SteamVR depots: `{line}`" for line in filtered_first(reports / "steamvr-depots-key-lines.txt", 5)])
|
||||
notable.extend([f"- SteamOS mirror: `{line}`" for line in filtered_first(reports / "steamos-mirror-key-lines.txt", 5)])
|
||||
|
||||
Reference in new issue
Block a user