Nice place name for UNIX time

This commit is contained in:
Luke Rogers 2012-04-21 01:45:02 +12:00
parent d7bc5c1cce
commit e959c27d66

View file

@ -20,8 +20,13 @@ def time_command(inp, bot=None):
time = " ".join(request.xpath("//pod[@title='Result']/subpod/plain" \
"text/text()"))
time = time.replace(" | ", ", ")
place = " ".join(request.xpath("//pod[@title='Input interpretation']/" \
"subpod/plaintext/text()"))[16:].title()
# nice place name for UNIX time
if inp.lower() == "unix":
place = "Unix Epoch"
else:
place = " ".join(request.xpath("//pod[@title='Input interpretation']/" \
"subpod/plaintext/text()"))[16:].title()
if time:
# if wolfram alpha had to guess a place, then show the place it chose
@ -31,4 +36,4 @@ def time_command(inp, bot=None):
# return time
return "%s - \x02%s\x02" % (time, place)
else:
return "Could not get the time for '%s'" % inp
return "Could not get the time for '%s'" % inp