diff options
author | dec05eba <dec05eba@protonmail.com> | 2021-03-05 11:23:10 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2021-03-05 11:23:10 +0100 |
commit | cff81a0630937e0ffd59198a43a18f6c2b66b19a (patch) | |
tree | 5877dddfdd1626a1eef2d030889e1c1c7b6b6b7e /src | |
parent | ef49fb417f582ec837cde6b551a0bf0cfafe3d4d (diff) |
Fix start after
Diffstat (limited to 'src')
-rw-r--r-- | src/rss_html_common.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/src/rss_html_common.c b/src/rss_html_common.c index e8e98a5..c72273c 100644 --- a/src/rss_html_common.c +++ b/src/rss_html_common.c @@ -21,24 +21,26 @@ int write_plugin_json_to_file(const char *dir, const char *filename, const char if(plugin_name) cJSON_AddStringToObject(json_body, "plugin", plugin_name); - cJSON *downloaded_item_json = cJSON_CreateObject(); - if(!downloaded_item_json) { + cJSON *downloaded_json = cJSON_AddArrayToObject(json_body, "downloaded"); + if(!downloaded_json) { result = -1; goto cleanup; } - if(start_after) + if(start_after) { + cJSON *downloaded_item_json = cJSON_CreateObject(); + if(!downloaded_item_json) { + result = -1; + goto cleanup; + } + cJSON_AddStringToObject(downloaded_item_json, "title", start_after); - if(start_after_url) - cJSON_AddStringToObject(downloaded_item_json, "url", start_after_url); - cJSON_AddStringToObject(downloaded_item_json, "time", updated); + cJSON_AddStringToObject(downloaded_item_json, "time", updated); + if(start_after_url) + cJSON_AddStringToObject(downloaded_item_json, "url", start_after_url); - cJSON *downloaded_json = cJSON_AddArrayToObject(json_body, "downloaded"); - if(!downloaded_json) { - result = -1; - goto cleanup; + cJSON_AddItemToArray(downloaded_json, downloaded_item_json); } - cJSON_AddItemToArray(downloaded_json, downloaded_item_json); char *json_body_str = cJSON_Print(json_body); if(!json_body_str) { |