Login
1 branch 0 tags
Ben (Desktop/Arch) Improved podcast episode list e9e6fb4 29 days ago 81 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];
	char pub_date[64];
} 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);

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

// Write episode metadata as simple XML to entry.xml at out_path.
bool podcast_write_entry(const char* out_path, const podcast_episode_t* ep);

// Parse a single entry.xml file into a podcast_episode_t.
// Returns true on success.
bool podcast_parse_entry(const char* path, podcast_episode_t* episode);