diff --git a/API.md b/API.md index c6a1cbe3..50eab662 100644 --- a/API.md +++ b/API.md @@ -334,12 +334,15 @@ Optional parameters: Returns: json: - {"country": "United States", + {"continent": "North America", + "country": "United States", "region": "California", "city": "Mountain View", + "postal_code": "94035", "timezone": "America/Los_Angeles", "latitude": 37.386, - "longitude": -122.0838 + "longitude": -122.0838, + "accuracy": 1000 } json: {"error": "The address 127.0.0.1 is not in the database." diff --git a/data/interfaces/default/ip_address_modal.html b/data/interfaces/default/ip_address_modal.html index 6c664a07..99391b15 100644 --- a/data/interfaces/default/ip_address_modal.html +++ b/data/interfaces/default/ip_address_modal.html @@ -19,16 +19,19 @@
@@ -55,12 +58,15 @@ if ('error' in data) { $('#ip_error').html(' ' + data.error + '

').show(); } else { + $('#continent').html(data.continent); $('#country').html(data.country); - $('#city').html(data.city); $('#region').html(data.region); + $('#city').html(data.city); + $('#postal_code').html(data.postal_code); $('#timezone').html(data.timezone); - $('#lat').html(data.latitude); - $('#lon').html(data.longitude); + $('#latitude').html(data.latitude); + $('#longitude').html(data.longitude); + $('#accuracy').html(data.accuracy + ' km'); } } }); diff --git a/plexpy/helpers.py b/plexpy/helpers.py index 8a8c3342..e4e97329 100644 --- a/plexpy/helpers.py +++ b/plexpy/helpers.py @@ -601,12 +601,15 @@ def geoip_lookup(ip_address): except Exception as e: return 'Error: %s' % e - geo_info = {'country': geo.country.name, + geo_info = {'continent': geo.continent.name, + 'country': geo.country.name, 'region': geo.subdivisions.most_specific.name, 'city': geo.city.name, + 'postal_code': geo.postal.code, 'timezone': geo.location.time_zone, 'latitude': geo.location.latitude, - 'longitude': geo.location.longitude + 'longitude': geo.location.longitude, + 'accuracy': geo.location.accuracy_radius } return geo_info diff --git a/plexpy/webserve.py b/plexpy/webserve.py index 4508bcb3..4ff7eeaf 100644 --- a/plexpy/webserve.py +++ b/plexpy/webserve.py @@ -4278,12 +4278,15 @@ class WebInterface(object): Returns: json: - {"country": "United States", + {"continent": "North America", + "country": "United States", "region": "California", "city": "Mountain View", + "postal_code": "94035", "timezone": "America/Los_Angeles", "latitude": 37.386, - "longitude": -122.0838 + "longitude": -122.0838, + "accuracy": 1000 } json: {"error": "The address 127.0.0.1 is not in the database."