master
commit
e10ea74335
7
Makefile
7
Makefile
|
@ -2,17 +2,24 @@
|
||||||
# Copyright 2008, Sean B. Palmer, inamidst.com
|
# Copyright 2008, Sean B. Palmer, inamidst.com
|
||||||
# Licensed under the Eiffel Forum License 2.
|
# Licensed under the Eiffel Forum License 2.
|
||||||
|
|
||||||
|
# archive - Create phenny.tar.bz2 using git archive
|
||||||
archive: ;
|
archive: ;
|
||||||
# hg archive -t tbz2 phenny-hg.tar.bz2
|
# hg archive -t tbz2 phenny-hg.tar.bz2
|
||||||
git archive --format=tar --prefix=phenny/ HEAD | bzip2 > phenny.tar.bz2
|
git archive --format=tar --prefix=phenny/ HEAD | bzip2 > phenny.tar.bz2
|
||||||
|
|
||||||
|
# ci - Check the code into git and push to github
|
||||||
ci: ;
|
ci: ;
|
||||||
# hg ci
|
# hg ci
|
||||||
git commit -a && git push origin master
|
git commit -a && git push origin master
|
||||||
|
|
||||||
|
# log - Show a log of recent updates
|
||||||
log: ;
|
log: ;
|
||||||
# git log --date=short --format='%h %ad %s'
|
# git log --date=short --format='%h %ad %s'
|
||||||
git graph
|
git graph
|
||||||
|
|
||||||
|
# sync - Push phenny to pubble:opt/phenny/
|
||||||
sync: ;
|
sync: ;
|
||||||
rsync -avz ./ pubble:opt/phenny/
|
rsync -avz ./ pubble:opt/phenny/
|
||||||
|
|
||||||
|
help: ;
|
||||||
|
@egrep '^# [a-z]+ - ' Makefile | sed 's/# //'
|
||||||
|
|
|
@ -168,7 +168,7 @@ def noteuri(phenny, input):
|
||||||
if not hasattr(phenny.bot, 'last_seen_uri'):
|
if not hasattr(phenny.bot, 'last_seen_uri'):
|
||||||
phenny.bot.last_seen_uri = {}
|
phenny.bot.last_seen_uri = {}
|
||||||
phenny.bot.last_seen_uri[input.sender] = uri
|
phenny.bot.last_seen_uri[input.sender] = uri
|
||||||
noteuri.rule = r'.*(http://[^<> "\x01]+)[,.]?'
|
noteuri.rule = r'.*(http[s]?://[^<> "\x01]+)[,.]?'
|
||||||
noteuri.priority = 'low'
|
noteuri.priority = 'low'
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
|
@ -34,10 +34,15 @@ def service(phenny, input, command, args):
|
||||||
template = template.replace('${nick}', urllib.quote(input.nick))
|
template = template.replace('${nick}', urllib.quote(input.nick))
|
||||||
uri = template.replace('${sender}', urllib.quote(input.sender))
|
uri = template.replace('${sender}', urllib.quote(input.sender))
|
||||||
|
|
||||||
|
info = web.head(uri)
|
||||||
|
if isinstance(info, list):
|
||||||
|
info = info[0]
|
||||||
|
if not 'text/plain' in info.get('content-type', '').lower():
|
||||||
|
return phenny.reply("Sorry, the service didn't respond in plain text.")
|
||||||
bytes = web.get(uri)
|
bytes = web.get(uri)
|
||||||
lines = bytes.splitlines()
|
lines = bytes.splitlines()
|
||||||
if not lines:
|
if not lines:
|
||||||
return phenny.reply('Sorry, the service is broken.')
|
return phenny.reply("Sorry, the service didn't respond any output.")
|
||||||
phenny.say(lines[0][:350])
|
phenny.say(lines[0][:350])
|
||||||
|
|
||||||
def refresh(phenny):
|
def refresh(phenny):
|
||||||
|
|
|
@ -29,7 +29,8 @@ def loadReminders(fn):
|
||||||
for line in f:
|
for line in f:
|
||||||
line = line.strip()
|
line = line.strip()
|
||||||
if line:
|
if line:
|
||||||
tellee, teller, verb, timenow, msg = line.split('\t', 4)
|
try: tellee, teller, verb, timenow, msg = line.split('\t', 4)
|
||||||
|
except ValueError: continue # @@ hmm
|
||||||
result.setdefault(tellee, []).append((teller, verb, timenow, msg))
|
result.setdefault(tellee, []).append((teller, verb, timenow, msg))
|
||||||
f.close()
|
f.close()
|
||||||
return result
|
return result
|
||||||
|
|
|
@ -46,6 +46,8 @@ def tr(phenny, context):
|
||||||
|
|
||||||
if input != output:
|
if input != output:
|
||||||
msg = translate(phrase, input, output)
|
msg = translate(phrase, input, output)
|
||||||
|
if isinstance(msg, str):
|
||||||
|
msg = msg.decode('utf-8')
|
||||||
if msg:
|
if msg:
|
||||||
msg = web.decode(msg) # msg.replace(''', "'")
|
msg = web.decode(msg) # msg.replace(''', "'")
|
||||||
msg = '"%s" (%s to %s, translate.google.com)' % (msg, input, output)
|
msg = '"%s" (%s to %s, translate.google.com)' % (msg, input, output)
|
||||||
|
|
Loading…
Reference in New Issue