Files
lisael-box/main/audio/podcast_manifest.h
T
Clément Saillant 0caffbbe8b feat(histoires): podcast manifest v2 parser
Pure C parser (cJSON) for /sdcard/podcasts/manifest.json v2
format (shows grouped with cover + episodes list). Skips shows
with zero episodes. SD loader guarded by #ifndef LISAEL_HOST_TEST.
Host test compiles and passes on Mac without IDF toolchain.
2026-06-14 17:10:44 +02:00

37 lines
1.3 KiB
C

// Podcast manifest v2 (grouped by show) for the Lisael Box "Histoires" screen.
// /sdcard/podcasts/manifest.json = JSON array of shows, each with a cover and
// a list of episodes. ASCII file names; UTF-8 show/title strings.
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
// Caps kept small: lisael_show_t is ~1.8 KB and the Histoires screen keeps a
// static array of these. Use static/heap storage, never a task stack.
#define LISAEL_MAX_SHOWS 8
#define LISAEL_MAX_EPISODES 12
typedef struct {
char file[64]; // audio basename under /sdcard/podcasts/ (e.g. "oli_01.m4a")
char title[80]; // UTF-8 display title
} lisael_episode_t;
typedef struct {
char show[48]; // UTF-8 show name
char cover[40]; // cover basename ("oli.bin"), "" if none
lisael_episode_t eps[LISAEL_MAX_EPISODES];
int n_eps;
} lisael_show_t;
// Pure parser: JSON string -> shows[]. Skips shows with zero episodes.
// Returns show count (>=0), or -1 if the JSON is not a valid array.
int lisael_podcast_parse(const char *json, lisael_show_t *shows, int max_shows);
// Read /sdcard/podcasts/manifest.json and parse it. Returns count or -1.
int lisael_podcast_load(lisael_show_t *shows, int max_shows);
#ifdef __cplusplus
}
#endif