Login
1 branch 0 tags
Ben (Desktop/Arch) Limited podcast episode list to 16 entries b36bce8 29 days ago 80 Commits
moon / src / podcast_xml.h
#pragma once
#include <stdbool.h>
#include <stddef.h>

#define PODCAST_MAX_FEEDS 32
#define PODCAST_MAX_EPISODES 64

typedef struct {
	char title[128];
	char url[256];
} podcast_feed_t;

typedef struct {
	char title[128];
	char guid[128];
	char enclosure_url[256];
} podcast_episode_t;

// Parse OPML file, extract RSS feed entries
// Returns number of feeds found, or -1 on error
int podcast_parse_opml(const char* path, podcast_feed_t* feeds, int max_feeds);

// Parse RSS feed file, extract episodes with audio enclosures
// Returns number of episodes found, or -1 on error
int podcast_parse_rss(const char* path,
                      podcast_episode_t* episodes,
                      int max_episodes);

// Extract raw <item> XML block at given index from RSS file
// Writes to out_path. Returns true on success.
bool podcast_extract_item(const char* rss_path,
                          int item_index,
                          const char* out_path);

// Sanitize podcast title to filesystem-safe directory name
void podcast_sanitize_title(const char* title, char* out, size_t out_size);