cleanup hanging code & README
This commit is contained in:
@@ -1 +0,0 @@
|
||||
3.9
|
||||
@@ -14,9 +14,6 @@ Keyboard sounds are sourced from [kbsim](https://github.com/tplai/kbsim) (MIT li
|
||||
```bash
|
||||
# Frontend dependencies
|
||||
cd frontend && npm install
|
||||
|
||||
# Download kbsim switch samples (~151 MP3 files)
|
||||
cd .. && ./scripts/fetch_kbsim_samples.sh
|
||||
```
|
||||
|
||||
## Development
|
||||
@@ -49,13 +46,13 @@ Or serve `frontend/dist` with any static file host.
|
||||
|
||||
### Keyboard shortcuts
|
||||
|
||||
| Shortcut | Action |
|
||||
|----------|--------|
|
||||
| Ctrl+Space | Play / pause |
|
||||
| Arrow keys | Nudge selected marker(s) one frame |
|
||||
| Alt+Scroll | Zoom timeline (centers on playhead) |
|
||||
| Backspace / Delete | Delete selected marker(s) |
|
||||
| Ctrl+A | Select all markers |
|
||||
| Shortcut | Action |
|
||||
| ------------------ | ----------------------------------- |
|
||||
| Ctrl+Space | Play / pause |
|
||||
| Arrow keys | Nudge selected marker(s) one frame |
|
||||
| Alt+Scroll | Zoom timeline (centers on playhead) |
|
||||
| Backspace / Delete | Delete selected marker(s) |
|
||||
| Ctrl+A | Select all markers |
|
||||
|
||||
## Project file format
|
||||
|
||||
@@ -64,7 +61,13 @@ Or serve `frontend/dist` with any static file host.
|
||||
"version": 2,
|
||||
"switch": "mxbrown",
|
||||
"markers": [
|
||||
{ "id": "m1", "time": 1.234, "key": "a", "code": "KeyA", "releaseTime": 1.312 }
|
||||
{
|
||||
"id": "m1",
|
||||
"time": 1.234,
|
||||
"key": "a",
|
||||
"code": "KeyA",
|
||||
"releaseTime": 1.312
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
@@ -79,7 +82,7 @@ Re-open the video manually after loading a project file.
|
||||
|
||||
## Switch samples
|
||||
|
||||
Samples live in `assets/samples/kbsim/` and are fetched via `scripts/fetch_kbsim_samples.sh`. Available profiles:
|
||||
Available profiles from [kbsim](https://github.com/tplai/kbsim):
|
||||
|
||||
NovelKeys Creams, Holy Pandas, Alpacas, Turquoise Tealios, Gateron Black Inks, Gateron Red Inks, Cherry MX Blacks, Cherry MX Browns, Cherry MX Blues, Kailh Box Navies, Buckling Spring, SKCM Blue Alps, Topre.
|
||||
|
||||
|
||||
@@ -1,81 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
DEST="$ROOT/assets/samples/kbsim"
|
||||
TMP="$(mktemp -d)"
|
||||
REPO="https://github.com/tplai/kbsim.git"
|
||||
|
||||
cleanup() {
|
||||
rm -rf "$TMP"
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
echo "Cloning kbsim audio assets..."
|
||||
git clone --depth 1 --filter=blob:none --sparse "$REPO" "$TMP/kbsim"
|
||||
cd "$TMP/kbsim"
|
||||
git sparse-checkout set src/assets/audio
|
||||
|
||||
AUDIO_SRC="$TMP/kbsim/src/assets/audio"
|
||||
if [[ ! -d "$AUDIO_SRC" ]]; then
|
||||
echo "Expected audio directory not found in kbsim repo" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
rm -rf "$DEST"
|
||||
mkdir -p "$DEST"
|
||||
|
||||
# folder:switch_id pairs (kbsim folder name -> sfxkeeb switch id)
|
||||
PAIRS=(
|
||||
"cream:cream"
|
||||
"holypanda:holypanda"
|
||||
"alpaca:alpaca"
|
||||
"turquoise:turquoise"
|
||||
"blackink:inkblack"
|
||||
"redink:inkred"
|
||||
"mxblack:mxblack"
|
||||
"mxbrown:mxbrown"
|
||||
"mxblue:mxblue"
|
||||
"boxnavy:boxnavy"
|
||||
"buckling:buckling"
|
||||
"bluealps:alpsblue"
|
||||
"topre:topre"
|
||||
)
|
||||
|
||||
for pair in "${PAIRS[@]}"; do
|
||||
folder="${pair%%:*}"
|
||||
switch_id="${pair##*:}"
|
||||
if [[ -d "$AUDIO_SRC/$folder" ]]; then
|
||||
cp -R "$AUDIO_SRC/$folder" "$DEST/$switch_id"
|
||||
echo " copied $folder -> $switch_id"
|
||||
else
|
||||
echo " warning: missing folder $folder" >&2
|
||||
fi
|
||||
done
|
||||
|
||||
echo "Generating manifest.json..."
|
||||
python3 - "$DEST" <<'PY'
|
||||
import json
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
dest = Path(sys.argv[1])
|
||||
manifest: dict[str, dict[str, list[str]]] = {}
|
||||
|
||||
for switch_dir in sorted(dest.iterdir()):
|
||||
if not switch_dir.is_dir() or switch_dir.name == "__pycache__":
|
||||
continue
|
||||
switch_id = switch_dir.name
|
||||
press_dir = switch_dir / "press"
|
||||
release_dir = switch_dir / "release"
|
||||
press = sorted(p.stem for p in press_dir.glob("*.mp3")) if press_dir.is_dir() else []
|
||||
release = sorted(p.stem for p in release_dir.glob("*.mp3")) if release_dir.is_dir() else []
|
||||
manifest[switch_id] = {"press": press, "release": release}
|
||||
|
||||
manifest_path = dest / "manifest.json"
|
||||
manifest_path.write_text(json.dumps(manifest, indent=2) + "\n")
|
||||
total = sum(len(v["press"]) + len(v["release"]) for v in manifest.values())
|
||||
print(f" wrote {manifest_path} ({len(manifest)} switches, {total} samples)")
|
||||
PY
|
||||
|
||||
echo "Done. Samples installed to $DEST"
|
||||
Reference in New Issue
Block a user