aboutsummaryrefslogtreecommitdiff
path: root/src/rss_html_common.h
blob: cc22b247dcf2e7976c32a8f0b553947fb2e25255 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#ifndef RSS_HTML_COMMON_H
#define RSS_HTML_COMMON_H

#include <stddef.h>

#define MAX_UPDATE_ITEMS 10

typedef struct cJSON cJSON;

typedef struct {
    const char *title;
    const char *link;
} DownloadItemsData;

typedef struct {
    const char *title;
    const char *link;
    cJSON *json_data;
} TrackedItem;

int write_plugin_json_to_file(const char *dir, const char *filename, const char *url, const char *updated, DownloadItemsData *prev_download_items, size_t num_prev_download_items, const char *plugin_name);

/*
    Note: tracked_item.json_data becomes invalid after this call.
    @filenames can be NULL, in which case filenames are not stored for items. This is the case for html items.
    @tracked_dir is also modified and then restored at the end.
    @download_items and @timestamps both need to be @num_download_items long. If @filenames is not NULL, then it also has to be @num_download_items long.
*/
int tracked_item_update_latest(TrackedItem *tracked_item, char *tracked_dir, DownloadItemsData **download_items, char **filenames, long *timestamps, int num_download_items);

#endif