import view, import format

v2
Igor Chubin 5 years ago
parent f363315476
commit bb17342b06

@ -194,7 +194,7 @@ def get_wetter(location, ip, html=False, lang=None, query=None, location_name=No
cmd += ["--bg=dark"] cmd += ["--bg=dark"]
p = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE ) p = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE )
stdout, stderr = p.communicate(stdout) stdout, stderr = p.communicate(stdout.encode("utf-8"))
stdout = stdout.decode("utf-8") stdout = stdout.decode("utf-8")
stderr = stderr.decode("utf-8") stderr = stderr.decode("utf-8")
if p.returncode != 0: if p.returncode != 0:
@ -238,8 +238,8 @@ def get_moon(location, html=False, lang=None, query=None):
if lang: if lang:
env['LANG'] = lang env['LANG'] = lang
p = Popen(cmd, stdout=PIPE, stderr=PIPE, env=env) p = Popen(cmd, stdout=PIPE, stderr=PIPE, env=env)
stdout = stdout.decode("utf-8")
stdout = p.communicate()[0] stdout = p.communicate()[0]
stdout = stdout.decode("utf-8")
if query.get('no-terminal', False): if query.get('no-terminal', False):
stdout = remove_ansi(stdout) stdout = remove_ansi(stdout)

@ -10,7 +10,7 @@ import os
import time import time
from flask import render_template, send_file, make_response from flask import render_template, send_file, make_response
import wttrin_png import format.png
import parse_query import parse_query
from translations import get_message, FULL_TRANSLATION, PARTIAL_TRANSLATION, SUPPORTED_LANGS from translations import get_message, FULL_TRANSLATION, PARTIAL_TRANSLATION, SUPPORTED_LANGS
from buttons import add_buttons from buttons import add_buttons
@ -23,7 +23,7 @@ from globals import get_help_file, log, \
from location import is_location_blocked, location_processing from location import is_location_blocked, location_processing
from limits import Limits from limits import Limits
from wttr import get_wetter, get_moon from wttr import get_wetter, get_moon
from wttr_line import wttr_line from view.line import wttr_line
import cache import cache
@ -266,7 +266,7 @@ def wttr(location, request):
'location': location} 'location': location}
options.update(query) options.update(query)
cached_png_file = wttrin_png.make_wttr_in_png(png_filename, options=options) cached_png_file = format.png.make_wttr_in_png(png_filename, options=options)
response = make_response(send_file(cached_png_file, response = make_response(send_file(cached_png_file,
attachment_filename=png_filename, attachment_filename=png_filename,
mimetype='image/png')) mimetype='image/png'))

Loading…
Cancel
Save