From 6021a9a1e4bb136f216ccbcbe1b834c1c6a42c57 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Fri, 8 Dec 2006 09:05:07 +0000 Subject: [PATCH] multiple tracker messages --- library/pytorrent.py | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/library/pytorrent.py b/library/pytorrent.py index 7c4ebb62b..e66e301d6 100644 --- a/library/pytorrent.py +++ b/library/pytorrent.py @@ -395,12 +395,26 @@ class manager: if self.auto_seed_ratio == -1: self.apply_queue(efficient = False) # To work on current data elif event['event_type'] is self.constants['EVENT_TRACKER']: - self.set_supp_torrent_state_val( event['unique_ID'], - "tracker_status", - event['tracker_status']) - self.set_supp_torrent_state_val( event['unique_ID'], - "tracker_message", - event['message']) + unique_ID = event['unique_ID'] + status = event['tracker_status'] + message = event['message'] + tracker = message[message.find('"')+1:message.rfind('"')] + + self.set_supp_torrent_state_val(unique_ID, + "tracker_status", + (tracker, status)) + + old_state = self.get_supp_torrent_state(unique_ID) + try: + new = old_state['tracker_messages'] + except KeyError: + new = {} + + new[tracker] = message + + self.set_supp_torrent_state_val(unique_ID, + "tracker_messages", + new) event = pytorrent_core.pop_event()