|
@@ -20,6 +20,21 @@ def shutdown(bot):
|
|
|
def ffpb_hamburg_fetch(bot):
|
|
|
ffpb_fetch_stats(bot, 'http://hamburg.freifunk.net/nodes_ffhh/nodes.json', 'ffhh_stats')
|
|
|
|
|
|
+ if 'ffhh_rueckspiegel' in bot.memory and bot.memory['ffhh_rueckspiegel'] == True:
|
|
|
+ return
|
|
|
+
|
|
|
+ stats = bot.memory['ffpb_stats'] if 'ffpb_stats' in bot.memory else None
|
|
|
+ hamburg_data = bot.memory['ffhh_stats'] if 'ffhh_stats' in bot.memory else None
|
|
|
+ if not (stats is None or hamburg_data is None):
|
|
|
+ if hamburg_data['nodes_active'] < stats['nodes_active']:
|
|
|
+ print('HAMBURG überholt: {0}<{1}'.format(hamburg_data['nodes_active'], stats['nodes_active']))
|
|
|
+ bot.memory['ffhh_rueckspiegel'] = True
|
|
|
+
|
|
|
+ action_msg = u'schaut in den Rückspiegel und erblickt HAMBURG!'
|
|
|
+ action_target = bot.config.ffpb.msg_target
|
|
|
+ if not bot.config.ffpb.msg_target_public is None: action_target = bot.config.ffpb.msg_target_public
|
|
|
+ bot.msg(action_target, '\x01ACTION %s\x01' % action_msg)
|
|
|
+
|
|
|
@willie.module.commands('hamburg')
|
|
|
def ffpb_hamburg(bot, trigger):
|
|
|
hamburg_data = bot.memory['ffhh_stats'] if 'ffhh_stats' in bot.memory else None
|