diff options
-rwxr-xr-x | automedia | bin | 108448 -> 108448 bytes | |||
-rw-r--r-- | src/rss_html_common.c | 24 |
2 files changed, 13 insertions, 11 deletions
Binary files differ 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) { |