|
|
|
@ -10,17 +10,18 @@ import constants
|
|
|
|
|
import parse_query
|
|
|
|
|
import globals
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_moon(parsed_query):
|
|
|
|
|
|
|
|
|
|
location = parsed_query['orig_location']
|
|
|
|
|
html = parsed_query['html_output']
|
|
|
|
|
lang = parsed_query['lang']
|
|
|
|
|
hemisphere = parsed_query['hemisphere']
|
|
|
|
|
location = parsed_query["orig_location"]
|
|
|
|
|
html = parsed_query["html_output"]
|
|
|
|
|
lang = parsed_query["lang"]
|
|
|
|
|
hemisphere = parsed_query["hemisphere"]
|
|
|
|
|
|
|
|
|
|
date = None
|
|
|
|
|
if '@' in location:
|
|
|
|
|
date = location[location.index('@')+1:]
|
|
|
|
|
location = location[:location.index('@')]
|
|
|
|
|
if "@" in location:
|
|
|
|
|
date = location[location.index("@") + 1 :]
|
|
|
|
|
location = location[: location.index("@")]
|
|
|
|
|
|
|
|
|
|
cmd = [globals.PYPHOON]
|
|
|
|
|
if lang:
|
|
|
|
@ -41,16 +42,19 @@ def get_moon(parsed_query):
|
|
|
|
|
stdout = p.communicate()[0]
|
|
|
|
|
stdout = stdout.decode("utf-8")
|
|
|
|
|
|
|
|
|
|
if parsed_query.get('no-terminal', False):
|
|
|
|
|
if parsed_query.get("no-terminal", False):
|
|
|
|
|
stdout = globals.remove_ansi(stdout)
|
|
|
|
|
|
|
|
|
|
if parsed_query.get('dumb', False):
|
|
|
|
|
if parsed_query.get("dumb", False):
|
|
|
|
|
stdout = stdout.translate(globals.TRANSLATION_TABLE)
|
|
|
|
|
|
|
|
|
|
if html:
|
|
|
|
|
p = Popen(
|
|
|
|
|
["bash", globals.ANSI2HTML, "--palette=solarized", "--bg=dark"],
|
|
|
|
|
stdin=PIPE, stdout=PIPE, stderr=PIPE)
|
|
|
|
|
stdin=PIPE,
|
|
|
|
|
stdout=PIPE,
|
|
|
|
|
stderr=PIPE,
|
|
|
|
|
)
|
|
|
|
|
stdout, stderr = p.communicate(stdout.encode("utf-8"))
|
|
|
|
|
stdout = stdout.decode("utf-8")
|
|
|
|
|
stderr = stderr.decode("utf-8")
|
|
|
|
|