Spaces:
Running
Running
fixed the selection of custom songs from UI
Browse files- pyproject.toml +4 -0
- src/reachy_dance_tutor_app/config.py +14 -10
- src/reachy_dance_tutor_app/performances/README.md +48 -0
- src/reachy_dance_tutor_app/performances/custom/golden_kpop_demon_hunters/dance.json +0 -0
- src/reachy_dance_tutor_app/performances/custom/golden_kpop_demon_hunters/golden.wav +3 -0
- src/reachy_dance_tutor_app/performances/custom/golden_kpop_demon_hunters/manifest.json +14 -0
- src/reachy_dance_tutor_app/static/main.js +3 -1
- src/reachy_dance_tutor_app/tools/list_performance_clips.py +3 -1
pyproject.toml
CHANGED
|
@@ -93,6 +93,10 @@ reachy_dance_tutor_app = [
|
|
| 93 |
"profiles/**/*.txt",
|
| 94 |
"profiles/**/*.py",
|
| 95 |
"prompts/**/*.txt",
|
|
|
|
|
|
|
|
|
|
|
|
|
| 96 |
]
|
| 97 |
|
| 98 |
[tool.ruff]
|
|
|
|
| 93 |
"profiles/**/*.txt",
|
| 94 |
"profiles/**/*.py",
|
| 95 |
"prompts/**/*.txt",
|
| 96 |
+
"performances/**/*.json",
|
| 97 |
+
"performances/**/*.wav",
|
| 98 |
+
"performances/**/*.mp4",
|
| 99 |
+
"performances/**/*.md",
|
| 100 |
]
|
| 101 |
|
| 102 |
[tool.ruff]
|
src/reachy_dance_tutor_app/config.py
CHANGED
|
@@ -63,16 +63,20 @@ class Config:
|
|
| 63 |
if _local_perf_dir:
|
| 64 |
LOCAL_PERFORMANCE_DIR = Path(_local_perf_dir).resolve()
|
| 65 |
else:
|
| 66 |
-
#
|
| 67 |
-
#
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 76 |
PERFORMANCE_LIST_MAX = int(os.getenv("PERFORMANCE_LIST_MAX", "40"))
|
| 77 |
# Optional env-tuned head nudges (degrees); clamped in move_head.
|
| 78 |
MOVE_HEAD_YAW_DEG = int(os.getenv("MOVE_HEAD_YAW_DEG", "40"))
|
|
|
|
| 63 |
if _local_perf_dir:
|
| 64 |
LOCAL_PERFORMANCE_DIR = Path(_local_perf_dir).resolve()
|
| 65 |
else:
|
| 66 |
+
# Search multiple candidate locations for the performances/ directory:
|
| 67 |
+
# 1. Source-tree layout (pip install -e . / dev checkout)
|
| 68 |
+
# 2. Inside the installed package (package data)
|
| 69 |
+
# 3. Relative to cwd (systemd / manual launch)
|
| 70 |
+
_candidates = [
|
| 71 |
+
Path(__file__).resolve().parent.parent.parent / "performances", # <project>/performances
|
| 72 |
+
Path(__file__).resolve().parent / "performances", # <package>/performances
|
| 73 |
+
Path.cwd() / "performances", # cwd/performances
|
| 74 |
+
]
|
| 75 |
+
LOCAL_PERFORMANCE_DIR = next(
|
| 76 |
+
(p for p in _candidates if p.is_dir()),
|
| 77 |
+
_candidates[0], # default fallback even if none exist
|
| 78 |
+
)
|
| 79 |
+
logger.info("LOCAL_PERFORMANCE_DIR resolved to: %s (exists=%s)", LOCAL_PERFORMANCE_DIR, LOCAL_PERFORMANCE_DIR.is_dir())
|
| 80 |
PERFORMANCE_LIST_MAX = int(os.getenv("PERFORMANCE_LIST_MAX", "40"))
|
| 81 |
# Optional env-tuned head nudges (degrees); clamped in move_head.
|
| 82 |
MOVE_HEAD_YAW_DEG = int(os.getenv("MOVE_HEAD_YAW_DEG", "40"))
|
src/reachy_dance_tutor_app/performances/README.md
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Local Curated Performances
|
| 2 |
+
|
| 3 |
+
Put custom long-form song+dance performances under this directory.
|
| 4 |
+
|
| 5 |
+
Each performance lives in its own folder and must contain:
|
| 6 |
+
|
| 7 |
+
- `manifest.json`
|
| 8 |
+
- `dance.json`
|
| 9 |
+
- `dance.wav`
|
| 10 |
+
|
| 11 |
+
Optional:
|
| 12 |
+
|
| 13 |
+
- `preview.mp4`
|
| 14 |
+
|
| 15 |
+
Example:
|
| 16 |
+
|
| 17 |
+
```text
|
| 18 |
+
performances/
|
| 19 |
+
custom/
|
| 20 |
+
waka_waka/
|
| 21 |
+
manifest.json
|
| 22 |
+
dance.json
|
| 23 |
+
dance.wav
|
| 24 |
+
preview.mp4
|
| 25 |
+
```
|
| 26 |
+
|
| 27 |
+
Example `manifest.json`:
|
| 28 |
+
|
| 29 |
+
```json
|
| 30 |
+
{
|
| 31 |
+
"id": "waka_waka",
|
| 32 |
+
"title": "Waka Waka",
|
| 33 |
+
"artist": "Shakira",
|
| 34 |
+
"motion": "dance.json",
|
| 35 |
+
"audio": "dance.wav",
|
| 36 |
+
"preview_video": "preview.mp4",
|
| 37 |
+
"description": "High-energy authored routine for the chorus and verses.",
|
| 38 |
+
"tags": ["kids", "energetic", "soccer"]
|
| 39 |
+
}
|
| 40 |
+
```
|
| 41 |
+
|
| 42 |
+
Notes:
|
| 43 |
+
|
| 44 |
+
- `id` must be unique across local performances.
|
| 45 |
+
- `motion` defaults to `dance.json` if omitted.
|
| 46 |
+
- `audio` defaults to `dance.wav` if omitted.
|
| 47 |
+
- The app plays `dance.json` plus `dance.wav`; MP4 is only a source or preview asset.
|
| 48 |
+
- After adding a new local performance, restart the app so it rescans the folder.
|
src/reachy_dance_tutor_app/performances/custom/golden_kpop_demon_hunters/dance.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
src/reachy_dance_tutor_app/performances/custom/golden_kpop_demon_hunters/golden.wav
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:8ccace2e1a0b16bfe67559b275a87c9cc5ad5daa3c53b0b2c47057c870aba46a
|
| 3 |
+
size 2891194
|
src/reachy_dance_tutor_app/performances/custom/golden_kpop_demon_hunters/manifest.json
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"id": "golden_kpop_demon_hunters",
|
| 3 |
+
"title": "Golden",
|
| 4 |
+
"artist": "KPOP Demon Hunters (Our Last Night)",
|
| 5 |
+
"motion": "dance.json",
|
| 6 |
+
"audio": "golden.wav",
|
| 7 |
+
"description": "Procedurally generated 3-min choreography at 127 BPM. Sections: intro, verses, pre-chorus build, energetic chorus head-bangs, bridge cooldown, final chorus peak, outro fade.",
|
| 8 |
+
"tags": [
|
| 9 |
+
"kpop",
|
| 10 |
+
"energetic",
|
| 11 |
+
"rock",
|
| 12 |
+
"127bpm"
|
| 13 |
+
]
|
| 14 |
+
}
|
src/reachy_dance_tutor_app/static/main.js
CHANGED
|
@@ -476,9 +476,11 @@ async function init() {
|
|
| 476 |
kind = "status error";
|
| 477 |
} else if (!performanceClips.length) {
|
| 478 |
const repos = (statusPayload?.configured_repos || []).join(", ");
|
|
|
|
|
|
|
| 479 |
text = repos
|
| 480 |
? `No cached clips yet. Configured repos: ${repos}. Click Sync library.`
|
| 481 |
-
:
|
| 482 |
kind = "status warn";
|
| 483 |
} else {
|
| 484 |
text = `${performanceClips.length} performance clip(s) ready.`;
|
|
|
|
| 476 |
kind = "status error";
|
| 477 |
} else if (!performanceClips.length) {
|
| 478 |
const repos = (statusPayload?.configured_repos || []).join(", ");
|
| 479 |
+
const localDir = statusPayload?.local_dir || "unknown";
|
| 480 |
+
const localExists = statusPayload?.local_dir_exists ? "yes" : "no";
|
| 481 |
text = repos
|
| 482 |
? `No cached clips yet. Configured repos: ${repos}. Click Sync library.`
|
| 483 |
+
: `No clips found. Local dir: ${localDir} (exists: ${localExists}). Add manifest.json + dance.json + audio to performances/custom/.`;
|
| 484 |
kind = "status warn";
|
| 485 |
} else {
|
| 486 |
text = `${performanceClips.length} performance clip(s) ready.`;
|
src/reachy_dance_tutor_app/tools/list_performance_clips.py
CHANGED
|
@@ -67,10 +67,12 @@ class ListPerformanceClips(Tool):
|
|
| 67 |
}
|
| 68 |
for c in clips
|
| 69 |
]
|
| 70 |
-
logger.info("
|
|
|
|
| 71 |
return {
|
| 72 |
"clips": payload,
|
| 73 |
"count": len(payload),
|
| 74 |
"cache_dir": str(cache_dir),
|
| 75 |
"local_dir": str(local_dir),
|
|
|
|
| 76 |
}
|
|
|
|
| 67 |
}
|
| 68 |
for c in clips
|
| 69 |
]
|
| 70 |
+
logger.info("list_performance_clips: count=%s local_dir=%s exists=%s",
|
| 71 |
+
len(payload), local_dir, local_dir.is_dir())
|
| 72 |
return {
|
| 73 |
"clips": payload,
|
| 74 |
"count": len(payload),
|
| 75 |
"cache_dir": str(cache_dir),
|
| 76 |
"local_dir": str(local_dir),
|
| 77 |
+
"local_dir_exists": local_dir.is_dir(),
|
| 78 |
}
|