Do not show location when q or Q is specified (fixes #232)
This commit is contained in:
parent
7cc50bec2b
commit
4a423fdd58
1 changed files with 9 additions and 4 deletions
13
lib/wttr.py
13
lib/wttr.py
|
|
@ -165,8 +165,13 @@ def get_wetter(location, ip, html=False, lang=None, query=None, location_name=No
|
||||||
if query.get('no-city', False):
|
if query.get('no-city', False):
|
||||||
stdout = "\n".join(stdout.splitlines()[2:]) + "\n"
|
stdout = "\n".join(stdout.splitlines()[2:]) + "\n"
|
||||||
|
|
||||||
if full_address and query.get('format', 'txt') != 'png':
|
if full_address \
|
||||||
line = "%s: %s [%s]\n" % (get_message('LOCATION', lang).encode('utf-8'), full_address.encode('utf-8'), location)
|
and query.get('format', 'txt') != 'png' \
|
||||||
|
and (not query.get('no-city') and not query.get('no-caption')):
|
||||||
|
line = "%s: %s [%s]\n" % (
|
||||||
|
get_message('LOCATION', lang).encode('utf-8'),
|
||||||
|
full_address.encode('utf-8'),
|
||||||
|
location.encode('utf-8'))
|
||||||
stdout += line
|
stdout += line
|
||||||
|
|
||||||
if query.get('padding', False):
|
if query.get('padding', False):
|
||||||
|
|
@ -212,8 +217,8 @@ def get_moon(location, html=False, lang=None):
|
||||||
if date:
|
if date:
|
||||||
try:
|
try:
|
||||||
dateutil.parser.parse(date)
|
dateutil.parser.parse(date)
|
||||||
except:
|
except Exception as e:
|
||||||
pass
|
print("ERROR: %s" % e)
|
||||||
else:
|
else:
|
||||||
cmd += [date]
|
cmd += [date]
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue