Commit ·
26dafbb
1
Parent(s): ef2ccb5
fix: resolve 'too many values to unpack' in score_pacing by handling dictionary energy data
Browse files
server.py
CHANGED
|
@@ -949,7 +949,19 @@ def score_pacing(energies: list, start: float, end: float) -> int:
|
|
| 949 |
"""
|
| 950 |
if not energies:
|
| 951 |
return 50 # neutral default
|
| 952 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 953 |
if not window_energies:
|
| 954 |
return 50
|
| 955 |
duration = end - start
|
|
|
|
| 949 |
"""
|
| 950 |
if not energies:
|
| 951 |
return 50 # neutral default
|
| 952 |
+
|
| 953 |
+
window_energies = []
|
| 954 |
+
for d in energies:
|
| 955 |
+
# Handle both dict format (from analyze_audio_energy) and legacy tuple format
|
| 956 |
+
if isinstance(d, dict):
|
| 957 |
+
t = d.get("start_time", 0)
|
| 958 |
+
val = d.get("energy", 0)
|
| 959 |
+
else:
|
| 960 |
+
t, val = d
|
| 961 |
+
|
| 962 |
+
if start <= t <= end:
|
| 963 |
+
window_energies.append(val)
|
| 964 |
+
|
| 965 |
if not window_energies:
|
| 966 |
return 50
|
| 967 |
duration = end - start
|