aboutsummaryrefslogtreecommitdiff
path: root/src/rss_html_common.h
blob: 085ddc1b410e2d7c130740f12af10a819ae14f51 (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

#define MAX_UPDATE_ITEMS 10

typedef struct cJSON cJSON;

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

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

int write_plugin_json_to_file(const char *dir, const char *filename, const char *url, const char *updated, const char *start_after, const char *start_after_url, const char *plugin_name);

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

#endif