Skip to content

Commit

Permalink
Fix: accuweather pressure
Browse files Browse the repository at this point in the history
  • Loading branch information
RingOV committed Nov 6, 2015
1 parent 605fd0e commit e8824f7
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 10 deletions.
2 changes: 1 addition & 1 deletion gis-weather.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/python3
#
# gis_weather.py
v = '0.7.9.3'
v = '0.7.9.4'
# Copyright (C) 2013-2015 Alexander Koltsov <ringov@mail.ru>
#
# This program is free software: you can redistribute it and/or modify
Expand Down
Binary file modified i18n/uk/LC_MESSAGES/gis-weather.mo
Binary file not shown.
6 changes: 3 additions & 3 deletions po/uk.po
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Gis Weather\n"
"POT-Creation-Date: 2015-10-25 19:42+0300\n"
"PO-Revision-Date: 2015-10-25 16:46+0000\n"
"Last-Translator: Alexander Koltsov <ringov@mail.ru>\n"
"PO-Revision-Date: 2015-11-03 00:21+0000\n"
"Last-Translator: Victor Butko <victor.butko@gmail.com>\n"
"Language-Team: Ukrainian (http://www.transifex.com/gis-weather-team/gis-weather/language/uk/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
Expand Down Expand Up @@ -369,7 +369,7 @@ msgstr "погода отримана"

#: services/openweathermap.py:15
msgid "How to get"
msgstr ""
msgstr "Як отримати"

#: dialogs/city_id_dialog.py:71
msgid "Choose your city on"
Expand Down
15 changes: 10 additions & 5 deletions services/accuweather.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from utils import weather_vars, gw_vars
from utils.opener import urlopener
from utils.convert import C_to_F, C_to_K, F_to_C, convert_from_kmh, convert_from_C
from utils.convert import C_to_F, C_to_K, F_to_C, convert_from_kmh, convert_from_C, convert_from_inHg, convert_from_hPa
import re
import time
import os
Expand Down Expand Up @@ -274,10 +274,15 @@ def get_weather():
return False

# pressure now
press_now = re.findall('Pressure.*>(\d+)', source)
try:
press_now[0] = str(round(int(press_now[0])*0.75))+' mmHg;'+str(round(int(press_now[0])*0.0295))+' inHg;'+press_now[0]+' hPa'
except:
press = re.findall('Pressure.*>(.+?)<', source)
if press:
press_now = [press[0].split()[0]]
press_scale = press[0].split()[1]
if press_scale == 'mb':
press_now[0] = convert_from_hPa(press_now[0])
if press_scale == 'in':
press_now[0] = convert_from_inHg(press_now[0])
else:
press_now = ['n/a mmHg;n/a inHg;n/a hPa']
# humidity now
hum_now = re.findall('Humidity.*>(\d+)', source)
Expand Down
5 changes: 4 additions & 1 deletion utils/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,7 @@ def convert_from_mmHg(mmHg):


def convert_from_hPa(hPa):
return str(round(float(hPa)*0.75))+' mmHg;'+str(round(float(hPa)*0.0295))+' inHg;'+str(round(float(hPa)))+' hPa'
return str(round(float(hPa)*0.75))+' mmHg;'+str(round(float(hPa)*0.0295))+' inHg;'+str(round(float(hPa)))+' hPa'

def convert_from_inHg(inHg):
return str(round(float(inHg)*25.4))+' mmHg;'+str(round(float(inHg)))+' inHg;'+str(round(float(inHg)*33.86))+' hPa'

0 comments on commit e8824f7

Please sign in to comment.