mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2024-11-26 12:53:12 -06:00
Switched Geocoding library to OpenStreetMap's Nominatim API. Closes #390
This commit is contained in:
parent
f4ecf10885
commit
3d8519313e
@ -9,6 +9,7 @@
|
|||||||
* There are some changes to the autocomplete users feature:
|
* There are some changes to the autocomplete users feature:
|
||||||
* Now users can search for twitter screen names or display names in the database.
|
* Now users can search for twitter screen names or display names in the database.
|
||||||
* It is possible to undefine keystrokes in the current keymap in TWBlue. This allows you, for example, to redefine keystrokes completely.
|
* It is possible to undefine keystrokes in the current keymap in TWBlue. This allows you, for example, to redefine keystrokes completely.
|
||||||
|
* We have changed our Geocoding service to the Nominatim API from OpenStreetMap. Addresses present in tweets are going to be determined by this service, as the Google Maps API now requires an API key. ([#390](https://github.com/manuelcortez/TWBlue/issues/390))
|
||||||
* Added a limited version of the Twitter's Streaming API: The Streaming API will work only for tweets, and will receive tweets only by people you follow. Protected users are not possible to be streamed. It is possible that during high tweet traffic, the Stream might get disconnected at times, but TWBlue should be capable of detecting this problem and reconnecting the stream again. ([#385](https://github.com/manuelcortez/TWBlue/pull/385))
|
* Added a limited version of the Twitter's Streaming API: The Streaming API will work only for tweets, and will receive tweets only by people you follow. Protected users are not possible to be streamed. It is possible that during high tweet traffic, the Stream might get disconnected at times, but TWBlue should be capable of detecting this problem and reconnecting the stream again. ([#385](https://github.com/manuelcortez/TWBlue/pull/385))
|
||||||
* Fixed an issue that made TWBlue to not show a dialog when attempting to show a profile for a suspended user. ([#387](https://github.com/manuelcortez/TWBlue/issues/387))
|
* Fixed an issue that made TWBlue to not show a dialog when attempting to show a profile for a suspended user. ([#387](https://github.com/manuelcortez/TWBlue/issues/387))
|
||||||
* Added support for Twitter audio and videos: Tweets which contains audio or videos will be detected as audio items, and you can playback those with the regular command to play audios. ([#384,](https://github.com/manuelcortez/TWBlue/pull/384))
|
* Added support for Twitter audio and videos: Tweets which contains audio or videos will be detected as audio items, and you can playback those with the regular command to play audios. ([#384,](https://github.com/manuelcortez/TWBlue/pull/384))
|
||||||
|
@ -9,7 +9,7 @@ oauthlib
|
|||||||
requests-oauthlib
|
requests-oauthlib
|
||||||
requests-toolbelt
|
requests-toolbelt
|
||||||
pypubsub
|
pypubsub
|
||||||
pygeocoder
|
geopy
|
||||||
arrow
|
arrow
|
||||||
python-dateutil
|
python-dateutil
|
||||||
futures
|
futures
|
||||||
|
@ -35,17 +35,16 @@ from mysc.repeating_timer import RepeatingTimer
|
|||||||
from mysc import restart
|
from mysc import restart
|
||||||
import config
|
import config
|
||||||
import widgetUtils
|
import widgetUtils
|
||||||
import pygeocoder
|
|
||||||
from pygeolib import GeocoderError
|
|
||||||
import logging
|
import logging
|
||||||
import webbrowser
|
import webbrowser
|
||||||
|
from geopy.geocoders import Nominatim
|
||||||
from mysc import localization
|
from mysc import localization
|
||||||
import os
|
import os
|
||||||
import languageHandler
|
import languageHandler
|
||||||
|
|
||||||
log = logging.getLogger("mainController")
|
log = logging.getLogger("mainController")
|
||||||
|
|
||||||
geocoder = pygeocoder.Geocoder()
|
geocoder = Nominatim(user_agent="TWBlue")
|
||||||
|
|
||||||
class Controller(object):
|
class Controller(object):
|
||||||
|
|
||||||
@ -1001,19 +1000,17 @@ class Controller(object):
|
|||||||
if tweet.coordinates != None:
|
if tweet.coordinates != None:
|
||||||
x = tweet.coordinates["coordinates"][0]
|
x = tweet.coordinates["coordinates"][0]
|
||||||
y = tweet.coordinates["coordinates"][1]
|
y = tweet.coordinates["coordinates"][1]
|
||||||
address = geocoder.reverse_geocode(y, x, language = languageHandler.curLang)
|
address = geocoder.reverse("{}, {}".format(y, x), language = languageHandler.curLang)
|
||||||
if event == None: output.speak(address[0].__str__())
|
if event == None: output.speak(address.address)
|
||||||
else: self.view.show_address(address[0].__str__())
|
else: self.view.show_address(address.address)
|
||||||
else:
|
else:
|
||||||
output.speak(_(u"There are no coordinates in this tweet"))
|
output.speak(_(u"There are no coordinates in this tweet"))
|
||||||
except GeocoderError:
|
|
||||||
output.speak(_(u"There are no results for the coordinates in this tweet"))
|
|
||||||
except ValueError:
|
except ValueError:
|
||||||
output.speak(_(u"Error decoding coordinates. Try again later."))
|
output.speak(_(u"Error decoding coordinates. Try again later."))
|
||||||
except KeyError:
|
# except KeyError:
|
||||||
pass
|
# pass
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
pass
|
output.speak(_("Unable to find address in OpenStreetMap."))
|
||||||
|
|
||||||
def view_reverse_geocode(self, event=None):
|
def view_reverse_geocode(self, event=None):
|
||||||
try:
|
try:
|
||||||
|
Loading…
Reference in New Issue
Block a user