diff --git a/compare.py b/compare.py index 435dd66..f8ca49b 100644 --- a/compare.py +++ b/compare.py @@ -88,16 +88,23 @@ if __name__ == "__main__": if cheaper_listings: comparison_results.append(comparison_result) - break + #break + + print("\nFinished comparing! Found " + str(len(comparison_results)) + " possibly cheaper listings") now = datetime.now() # current date and time + duration_compare = datetime.now() - compare_start_timestamp + hours, remainder = divmod(duration_compare.total_seconds(), 3600) + minutes, seconds = divmod(remainder, 60) + duration_compare = str(hours) +"h " + str(minutes) + "m " + str(round(seconds, 2)) + "s" + exp = exhtml.exporter("./html_out/") for comparison in sorted(comparison_results, key=lambda d: d['max_price_delta'], reverse=True): exp.export_comparison(comparison['seller_listing'], comparison['competitor_listings']) - exp.export_startpage(str(database_lenght), len(comparison), datetime.timestamp(compare_start_timestamp), now.strftime("%m/%d/%Y, %H:%M:%S")) + exp.export_startpage(str(database_lenght), len(comparison_results), duration_compare, now.strftime("%m/%d/%Y, %H:%M:%S")) diff --git a/export_html.py b/export_html.py index fd41c04..b226c85 100644 --- a/export_html.py +++ b/export_html.py @@ -60,8 +60,11 @@ class exporter: f.close() def export_startpage(self, seller_listings_count, cheaper_listings_count, compare_time, date): - duration_export = datetime.timestamp(self.tsStart) - print("Comparison needed: ", duration_export) + + duration_export = datetime.now() - self.tsStart + hours, remainder = divmod(duration_export.total_seconds(), 3600) + minutes, seconds = divmod(remainder, 60) + duration_export = str(hours) +"h " + str(minutes) + "m " + str(round(seconds, 2)) + "s" f = open(os.path.join(self.export_dir, "index.html"), "a") f.write(thtml.html_startpage_head()) @@ -102,5 +105,7 @@ if __name__ == "__main__": exp = exporter("./html_out/") exp.export_comparison(seller_listing_dummy, competitor_listings_dummy) + exp.export_startpage(10, 2, 0, "d") + diff --git a/template_html.py b/template_html.py index 6bcac7a..c7418a0 100644 --- a/template_html.py +++ b/template_html.py @@ -170,6 +170,7 @@ def html_startpage_head(): def html_startpage_info(seller_listings_count, cheaper_listings_count, compare_time, export_time, date): + return '''

eBay competitor price compare