deluge/plugins/NetworkHealth/plugin.py

25 lines
1.0 KiB
Python
Raw Normal View History

2007-03-01 21:48:31 +00:00
class plugin_NetworkHealth:
2007-07-13 01:13:13 +00:00
def __init__(self, path, deluge_core, deluge_interface):
self.parent = deluge_interface # Using this, you can access the Deluge client
self.core = deluge_core
self.location = path
2007-03-01 21:48:31 +00:00
2007-07-13 01:13:13 +00:00
self.counter = 30
self.maxCount = self.counter
def update(self):
session_info = self.core.get_state()
if not session_info['has_incoming_connections'] and \
session_info['num_peers'] > 1:
message = "[No incoming connections]"
self.counter = self.counter - 1
if self.counter < 0:
# self.parent.addMessage("No incoming connections: you may be behind a firewall or router. Perhaps you need to forward the relevant ports.", "W")
self.counter = self.maxCount*2
self.maxCount = self.counter
else:
2007-07-20 21:14:11 +00:00
message = _("[Health: OK]")
2007-07-13 01:13:13 +00:00
self.counter = self.maxCount
2007-03-01 21:48:31 +00:00
2007-07-13 01:13:13 +00:00
self.parent.statusbar_temp_msg = self.parent.statusbar_temp_msg + ' ' + message