Finally fix rssnotify

(and convert spaces to tabs)
master
sfan5 2014-07-23 10:17:18 +02:00
parent cedd28c2f6
commit dca95a9911
1 changed files with 105 additions and 101 deletions

View File

@ -3,7 +3,9 @@
rssnotify.py - Phenny RssNotify Module rssnotify.py - Phenny RssNotify Module
Copyright 2013, sfan5 Copyright 2013, sfan5
""" """
import time, urllib.parse, re import time
import re
import web
import feedparser # sudo pip install feedparser import feedparser # sudo pip install feedparser
rssnotify = {} rssnotify = {}
@ -82,16 +84,18 @@ def rsscheck(phenny, input):
continue continue
if rssnotify["show_commit_link"]: if rssnotify["show_commit_link"]:
if rssnotify["use_git.io"]: if rssnotify["use_git.io"]:
params = urllib.parse.urlencode({'url' : feed_entry.link})
# Side note: git.io only works with *.github.com links # Side note: git.io only works with *.github.com links
u = urllib.urlopen("http://git.io/create", params) l, code = web.post("http://git.io/create", {'url': feed_entry.link})
l = u.read() if code == 200:
l = str(l, 'utf-8')
if len(l.strip()) == 6: if len(l.strip()) == 6:
commit_link = "http://git.io/" + l commit_link = "http://git.io/" + l
else: else:
commit_link = feed_entry.link commit_link = feed_entry.link
else: else:
commit_link = feed_entry.link commit_link = feed_entry.link
else:
commit_link = feed_entry.link
else: else:
commit_link = "" commit_link = ""