diff --git a/platypush/backend/weather/__init__.py b/platypush/backend/weather/__init__.py deleted file mode 100644 index 81dbb992..00000000 --- a/platypush/backend/weather/__init__.py +++ /dev/null @@ -1,39 +0,0 @@ -import time - -from platypush.backend import Backend -from platypush.context import get_plugin -from platypush.message.event.weather import NewWeatherConditionEvent - - -class WeatherBackend(Backend): - """ - Abstract class for weather update backends. - """ - - def __init__(self, plugin_name: str, poll_seconds: int, **kwargs): - """ - :param plugin_name: Name of the weather plugin to be used. - :param poll_seconds: How often the backend should check for updates, in seconds. - """ - super().__init__(**kwargs) - self.plugin_name = plugin_name - self.poll_seconds = poll_seconds - self.latest_update = {} - - def run(self): - super().run() - weather = get_plugin(self.plugin_name) - self.logger.info('Initialized {} backend'.format(self.__class__.__name__)) - - while not self.should_stop(): - current_weather = weather.get_current_weather().output - current_weather.pop('time', None) - - if current_weather != self.latest_update: - self.bus.post(NewWeatherConditionEvent(plugin_name=self.plugin_name, **current_weather)) - - self.latest_update = current_weather - time.sleep(self.poll_seconds) - - -# vim:sw=4:ts=4:et: diff --git a/platypush/backend/weather/openweathermap/__init__.py b/platypush/backend/weather/openweathermap/__init__.py deleted file mode 100644 index 26f35b1d..00000000 --- a/platypush/backend/weather/openweathermap/__init__.py +++ /dev/null @@ -1,23 +0,0 @@ -from platypush.backend.weather import WeatherBackend - - -class WeatherOpenweathermapBackend(WeatherBackend): - """ - Weather forecast backend that leverages the OpenWeatherMap API. - - Requires: - - * The :class:`platypush.plugins.weather.openweathermap.WeatherOpenWeatherMapPlugin` plugin configured - - """ - - def __init__(self, poll_seconds: int = 60, **kwargs): - """ - :param poll_seconds: How often the backend should check for updates (default: every minute). - """ - super().__init__( - plugin_name='weather.openweathermap', poll_seconds=poll_seconds, **kwargs - ) - - -# vim:sw=4:ts=4:et: diff --git a/platypush/backend/weather/openweathermap/manifest.yaml b/platypush/backend/weather/openweathermap/manifest.yaml deleted file mode 100644 index 70b8cc87..00000000 --- a/platypush/backend/weather/openweathermap/manifest.yaml +++ /dev/null @@ -1,8 +0,0 @@ -manifest: - events: - platypush.message.event.weather.NewWeatherConditionEvent: when there is a weather - condition update - install: - pip: [] - package: platypush.backend.weather.openweathermap - type: backend