wikifirc

filter irc.wikimedia.org on specific pages and users
git clone https://a3nm.net/git/wikifirc/
Log | Files | Refs | README

commit b92bb6c7a4a6feb90661dcee6d890af9cdab6207
parent 6a0fb584898c1db4726c36c1de3a0445b66d1366
Author: Antoine Amarilli <a3nm@a3nm.net>
Date:   Tue, 15 Nov 2016 12:03:57 +0100

capitalize names

Diffstat:
wikifirc | 9++++++---
1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/wikifirc b/wikifirc @@ -33,6 +33,9 @@ colors = { 'teal': 10, } +def capitalize(s): + return (s[0].upper() + s[1:]) + def colorize(text, color): """colorize for IRC, cf. http://irssi.org/documentation/formats""" return "\x03%02d%s\x0300" % (colors[color], text) @@ -102,7 +105,7 @@ if __name__ == "__main__": line = f.readline() if not line: break - register(pages, line.rstrip(), None) + register(capitalize(pages), line.rstrip(), None) f.close() except FileNotFoundError: pass @@ -129,7 +132,7 @@ if __name__ == "__main__": command = fields[0] if command == 'exit': break - value = ' '.join(fields[1:]) + value = capitalize(' '.join(fields[1:])) if command == "user": # register it as a user print("== I started to follow user %s" % value) @@ -147,7 +150,7 @@ if __name__ == "__main__": data = ' '.join(fields) line = Change(project, data) # a user is followed if its user page is followed - if user_namespaces[0] + line.username in pages: + if user_namespaces[0] + capitalize(line.username) in pages: # do not follow special pages special = False for special_namespace in special_namespaces: