log unknown locations
This commit is contained in:
parent
3d100c033c
commit
62face2c21
1 changed files with 19 additions and 14 deletions
|
@ -2,6 +2,9 @@
|
||||||
# vi:si:et:sw=4:sts=4:ts=4
|
# vi:si:et:sw=4:sts=4:ts=4
|
||||||
import ox.geo
|
import ox.geo
|
||||||
|
|
||||||
|
import logging
|
||||||
|
logger = logging.getLogger('pandora.statistics')
|
||||||
|
|
||||||
colors = {
|
colors = {
|
||||||
'system': {
|
'system': {
|
||||||
'Android': [0, 255, 0],
|
'Android': [0, 255, 0],
|
||||||
|
@ -100,8 +103,8 @@ class Statistics(dict):
|
||||||
split = ox.geo.split_geoname(item['location'])
|
split = ox.geo.split_geoname(item['location'])
|
||||||
if len(split) == 1:
|
if len(split) == 1:
|
||||||
split.insert(0, None)
|
split.insert(0, None)
|
||||||
|
if len(split) == 2:
|
||||||
city, country = split
|
city, country = split
|
||||||
|
|
||||||
country_data = ox.geo.get_country(country)
|
country_data = ox.geo.get_country(country)
|
||||||
continent = country_data.get('continent', '')
|
continent = country_data.get('continent', '')
|
||||||
region = ', '.join([continent, country_data.get('region', '')])
|
region = ', '.join([continent, country_data.get('region', '')])
|
||||||
|
@ -113,6 +116,8 @@ class Statistics(dict):
|
||||||
self._increment(self[mode]['country'], country)
|
self._increment(self[mode]['country'], country)
|
||||||
if city:
|
if city:
|
||||||
self._increment(self[mode]['city'], city)
|
self._increment(self[mode]['city'], city)
|
||||||
|
else:
|
||||||
|
logger.error('unknown geo value: %s', item['location'])
|
||||||
|
|
||||||
name = {}
|
name = {}
|
||||||
for key in ['system', 'browser']:
|
for key in ['system', 'browser']:
|
||||||
|
@ -122,7 +127,7 @@ class Statistics(dict):
|
||||||
if name[key]:
|
if name[key]:
|
||||||
self._increment(self[mode][key], name[key])
|
self._increment(self[mode][key], name[key])
|
||||||
|
|
||||||
key = key + 'version';
|
key = key + 'version'
|
||||||
self._increment(self[mode][key], version)
|
self._increment(self[mode][key], version)
|
||||||
|
|
||||||
if name.get('system') and name.get('browser'):
|
if name.get('system') and name.get('browser'):
|
||||||
|
|
Loading…
Reference in a new issue