Permalink
Browse files

added commons.wikimedia channel

  • Loading branch information...
1 parent d9e7b79 commit 11bf7aa627124936bd44a9f3c3d316de29e09856 @edsu committed Oct 16, 2011
Showing with 33 additions and 5 deletions.
  1. +23 −0 config.json.example
  2. +2 −1 stream.py
  3. +8 −4 updates.js
View
@@ -755,6 +755,29 @@
"Category talk": "category talk"
}
},
+ "#commons.wikipedia": {
+ "short": "co",
+ "long": "Wikimedia Commons",
+ "namespaces": {
+ "": "main",
+ "Category": "category",
+ "Media": "media",
+ "MediaWiki": "mediawiki",
+ "Template": "template",
+ "$1 talk": "project talk",
+ "Help talk": "help talk",
+ "User": "user",
+ "Template talk": "template talk",
+ "MediaWiki talk": "mediawiki talk",
+ "Talk": "talk",
+ "Help": "help",
+ "File talk": "file talk",
+ "File": "file",
+ "User talk": "user talk",
+ "Special": "special",
+ "Category talk": "category talk"
+ }
+ },
"#vi.wikipedia": {
"short": "vi",
"long": "Vietnamese Wikipedia",
View
@@ -44,6 +44,7 @@
def wikipedia_updates(callback):
endpoint = "http://wikistream.inkdroid.org/socket.io/1"
+ endpoint = "http://localhost:3000/socket.io/1"
session_id = post(endpoint).content.split(':')[0]
xhr_endpoint = "/".join((endpoint, "xhr-polling", session_id))
@@ -60,6 +61,6 @@ def wikipedia_updates(callback):
if __name__ == "__main__":
def print_page(update):
- print update['page']
+ print update
wikipedia_updates(print_page)
View
@@ -32,11 +32,15 @@ function main() {
function parse_msg (msg) {
// i guess this means i have two problems now? :-D
- var m = /\x0314\[\[\x0307(.+?)\x0314\]\]\x034 (.*?)\x0310.*\x0302(http.+?)\x03.+\x0303(.+?)\x03.+\x03 (.+) \x0310(.+)\x03/.exec(msg[1]);
- if (! m) { return null; }
+ var m = /\x0314\[\[\x0307(.+?)\x0314\]\]\x034 (.*?)\x0310.*\x0302(.*?)\x03.+\x0303(.+?)\x03.+\x03 (.*) \x0310(.*)\x03?.*/.exec(msg[1]);
+ if (! m) { console.log(msg); return null; }
// convert change in characters to a (possibly negative) integer
- var delta = parseInt(/([+-]\d+)/.exec(m[5])[1]);
+ if (m[5]) {
+ var delta = parseInt(/([+-]\d+)/.exec(m[5])[1]);
+ } else {
+ var delta = null;
+ }
// see if it looks like an anonymous edit
var user = m[4];
@@ -81,7 +85,7 @@ function processMessage (msg) {
if (m) {
redis.publish('wikipedia', JSON.stringify(m));
stats(m);
- console.log(m.page + " -- " + m.namespace);
+ console.log(m.page + " -- " + m.wikipediaShort);
}
}

0 comments on commit 11bf7aa

Please sign in to comment.