adding validated services? patching forcad_local.py

This commit is contained in:
Your Name
2026-08-13 08:32:35 +07:00
parent d485f61169
commit e795614e45
1459 changed files with 420036 additions and 436 deletions

View File

@@ -0,0 +1,37 @@
#include <stdio.h>
#include <string.h>
static void extract(const char *json) {
char tone_sequences_json[8192] = "[]";
const char *ts_pos = strstr(json, "\"toneSequences\":");
if (ts_pos)
{
const char *p = strchr(ts_pos, '[');
if (p)
{
int depth = 0;
const char *q = p;
while (*q && (q - p) < (int)sizeof(tone_sequences_json) - 2)
{
if (*q == '[') depth++;
else if (*q == ']') { depth--; if (depth == 0) { q++; break; } }
q++;
}
size_t len = (size_t)(q - p);
if (len > 0 && len < sizeof(tone_sequences_json))
{
memcpy(tone_sequences_json, p, len);
tone_sequences_json[len] = '\0';
}
}
}
printf("tone_sequences=%s\n", tone_sequences_json);
}
int main(void) {
const char *input =
"{\"name\":\"xxxsed\",\"description\":\"\",\"toneSequences\":[{\"id\":1758442926199.0464,\"baseNote\":60,\"intervalType\":\"unison\",\"chordType\":\"none\",\"tempo\":120,\"duration\":4,\"notes\":[60]}]}";
extract(input);
return 0;
}