From 2e6a04a73dd8b8a27e9a462be367b4f5645500f0 Mon Sep 17 00:00:00 2001 From: sfan5 Date: Sun, 26 Nov 2017 17:24:41 +0100 Subject: [PATCH] [rssnotify] Update configuration --- rssnotify.py | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/rssnotify.py b/rssnotify.py index aca3e63..b3d9a66 100755 --- a/rssnotify.py +++ b/rssnotify.py @@ -32,6 +32,20 @@ def to_unix_time(tstr): ts += int(g[3]) * 60 return ts +def resolve_channels(l): + ret = set() + for entry in l: + sign = 1 + if entry[0] == "-": + entry = entry[1:] + sign = -1 + c = phenny.bot.channels if entry == "*" else [entry] + if sign == 1: + ret |= set(c) + else: # sign == -1 + ret -= set(c) + return ret + class RssNotify(): def __init__(self, config): self.config = config @@ -114,24 +128,25 @@ class RssNotify(): committer_final = f_clong % (committer, committer_realname) return f_all % (committer_final, repo_name, commit_text, commit_hash, commit_link, commit_time) def _announce(self, phenny, message, chans): - if chans == "*": - chans = phenny.bot.channels - assert(type(chans) == list) + chans = resolve_channels(chans) for ch in chans: phenny.write(['PRIVMSG', ch], message) +################# + +c = ['*', '-#minetest-hub'] rssn = RssNotify({ "check_interval": 120, "show_link": True, "shorten_link": True, "logfile": os.getcwd() + "/rssnotify.log", "feeds": [ - ('https://github.com/minetest/minetest/commits/master.atom', "*"), - ('https://github.com/minetest/minetest_game/commits/master.atom', "*"), - ('https://github.com/minetest/minetestmapper/commits/master.atom', "*"), - ('https://github.com/minetest/master-server/commits/master.atom', "*"), - ('https://github.com/Uberi/Minetest-WorldEdit/commits/master.atom', "*"), - ('https://github.com/minetest-mods/mesecons/commits/master.atom', "*"), + ('https://github.com/minetest/minetest/commits/master.atom', c), + ('https://github.com/minetest/minetest_game/commits/master.atom', c), + ('https://github.com/minetest/minetestmapper/commits/master.atom', c), + ('https://github.com/minetest/master-server/commits/master.atom', c), + ('https://github.com/Uberi/Minetest-WorldEdit/commits/master.atom', c), + ('https://github.com/minetest-mods/mesecons/commits/master.atom', c), ('https://github.com/sfan5/phenny/commits/master.atom', ['##minetestbot']), ('https://github.com/sfan5/minetestbot-modules/commits/master.atom', ['##minetestbot']), ],