From a0707a1cf4583f7f00a6fbce2f50fecd09ca7be0 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sun, 27 Sep 2020 02:56:13 +0200 Subject: Fix multiple items using the same timestamp if updated at the same time They should use their download finished time instead --- src/rss_html_common.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/rss_html_common.c') diff --git a/src/rss_html_common.c b/src/rss_html_common.c index e383117..168195e 100644 --- a/src/rss_html_common.c +++ b/src/rss_html_common.c @@ -254,6 +254,8 @@ int tracked_item_update_latest(TrackedItem *tracked_item, char *tracked_dir, Dow struct json_value_s new_downloaded_json_val[MAX_UPDATE_ITEMS]; struct json_array_element_s new_downloaded_item_element[MAX_UPDATE_ITEMS]; + char items_timestamps[MAX_UPDATE_ITEMS][32]; + struct json_array_element_s *last_downloaded_element = NULL; for(int i = 0; i < num_download_items; ++i) { create_json_string(&title_json_value_str[i], download_items[i]->title, strlen(download_items[i]->title)); @@ -264,9 +266,9 @@ int tracked_item_update_latest(TrackedItem *tracked_item, char *tracked_dir, Dow init_json_value_str(&filename_json_value[i], &filename_json_value_str[i]); } - sprintf(updated, "%ld", timestamps[i]); - int updated_len = strlen(updated); - create_json_string(&time_value_str[i], updated, updated_len); + sprintf(items_timestamps[i], "%ld", timestamps[i]); + int updated_len = strlen(items_timestamps[i]); + create_json_string(&time_value_str[i], items_timestamps[i], updated_len); init_json_value_str(&time_json_value[i], &time_value_str[i]); create_json_string(&url_value_str[i], download_items[i]->link, strlen(download_items[i]->link)); -- cgit v1.2.3