From 0300d3ffc02666f8b86bad5eb96dffe1a518f303 Mon Sep 17 00:00:00 2001 From: Razvan Deaconescu Date: Sat, 21 Nov 2009 21:10:08 +0200 Subject: [PATCH] updated status parser to use seconds for ETA when calling add_status_messages_datetime function in DatabaseWriter --- log-parser/libtorrent/StatusParser.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/log-parser/libtorrent/StatusParser.py b/log-parser/libtorrent/StatusParser.py index 30f1f29..bfc8649 100644 --- a/log-parser/libtorrent/StatusParser.py +++ b/log-parser/libtorrent/StatusParser.py @@ -60,11 +60,8 @@ def libtorrent_canon_eta(non_canon_value): for i in range(len(eta_string_array), 4): eta.insert(0, 0) - # adriana >:) - eta2 = datetime.timedelta(eta[0], eta[3], 0, 0, eta[2], eta[1], 0) - eta_seconds = eta.days * 24 * 3600 + eta.seconds - return eta_seconds - #return eta + eta_td = datetime.timedelta(eta[0], eta[3], 0, 0, eta[2], eta[1], 0) + return eta_td # # sample libtorrent status line @@ -102,8 +99,9 @@ def libtorrent_parse_status_line(line): pass if pair[0] == "eta": eta = libtorrent_canon_eta(pair[1]) + eta_seconds = eta.days * 24 * 3600 + eta.seconds - return (num_peers, dht, download_speed, upload_speed, download_size, upload_size, eta) + return (num_peers, dht, download_speed, upload_speed, download_size, upload_size, eta_seconds) def libtorrent_parse_status_file(dbw, client_session_id, session_start, filename): @@ -121,14 +119,14 @@ def libtorrent_parse_status_file(dbw, client_session_id, session_start, filename if libtorrent_is_status_line(line) == False: continue - (num_peers, dht, download_speed, upload_speed, download_size, upload_size, eta_time) = libtorrent_parse_status_line(line) + (num_peers, dht, download_speed, upload_speed, download_size, upload_size, eta_seconds) = libtorrent_parse_status_line(line) message_time = message_time + one_second if DEBUG == True: print "(%d, %s, %s, %d, %d kb/s, %d kb/s, %d bytes, %d bytes)" % (num_peers, date, time, dht, download_speed, upload_speed, download_size, upload_size) - dbw.add_status_message_datetime(client_session_id, message_time, num_peers, dht, download_speed, upload_speed, download_size, upload_size, eta_time) + dbw.add_status_message_datetime(client_session_id, message_time, num_peers, dht, download_speed, upload_speed, download_size, upload_size, eta_seconds) except IOError: print "Error processing file %s." %filename -- 2.20.1