def __init__(self,
              longitude=-0.418,
              latitude=39.360,
              units=weatherservice.Units()):
     WeatherService.__init__(self, longitude, latitude, units)
     self.oauth = OAuth1(API_KEY, SHARED_SECRET)
     self.woeid = geocodeapi.get_woeid(latitude, longitude)
 def __init__(self, longitude=-0.418, latitude=39.360, units=weatherservice.Units()):
     WeatherService.__init__(self, longitude, latitude, units)
     self.search_string = geocodeapi.get_inv_direction(latitude, longitude)["search_string"]
     self.search_string = unicode2html(self.search_string)
     self.latlontrouble = False
     self.url1 = GOOGLE_WEATHER_URL % (self.search_string)
     self.url2 = GOOGLE_WEATHER_URL2 % (int(self.latitude * 1000000), int(self.longitude * 1000000))
Example #3
0
 def __init__(self,
              longitude=-0.418,
              latitude=39.360,
              units=weatherservice.Units()):
     WeatherService.__init__(self, longitude, latitude, units)
     self.oauth = OAuth1(API_KEY, SHARED_SECRET)
     self.woeid = geocodeapi.get_woeid(latitude, longitude)
 def __init__(self, longitude=-0.418, latitude=39.360,
              units=weatherservice.Units()):
     WeatherService.__init__(self, longitude, latitude, units)
     self.id = find_city(longitude, latitude)
     self.latidute = latitude
     self.longitude = longitude
     print('** OWM **')
     print(self.id, longitude, latitude)
 def __init__(self,
              longitude=-0.418,
              latitude=39.360,
              units=weatherservice.Units()):
     WeatherService.__init__(self, longitude, latitude, units)
     self.id = find_city(longitude, latitude)
     self.latidute = latitude
     self.longitude = longitude
     print('** OWM **')
     print(self.id, longitude, latitude)
 def __init__(self, longitude=-0.418, latitude=39.360,
              units=weatherservice.Units()):
     WeatherService.__init__(self, longitude, latitude, units)
     self.search_string = geocodeapi.get_inv_direction(
         latitude, longitude)['search_string']
     self.search_string = unicode2html(self.search_string)
     self.latlontrouble = False
     self.url1 = GOOGLE_WEATHER_URL % (self.search_string)
     self.url2 = GOOGLE_WEATHER_URL2 % (
         int(self.latitude * 1000000), int(self.longitude * 1000000))
Example #7
0
 def __init__(self,
              longitude=-0.418,
              latitude=39.360,
              units=weatherservice.Units(),
              key=KEY):
     WeatherService.__init__(self, longitude, latitude, units, key)
	def __init__(self,longitude=-0.418, latitude=39.360, units = weatherservice.Units(), key=''):
		WeatherService.__init__(self,longitude,latitude,units, key)
Example #9
0
    def process(self):
        day_time = datetime.time(06, 00)
        evening_time = datetime.time(17, 30)
        night_time = datetime.time(20, 00)

        # Weather settings held in file config.json
        # Location code found at: http://bulk.openweathermap.org/sample/city.list.json.gz
        # Include app id generated when you make you account at: http://openweathermap.org/api
        with open('config.json') as json_file:
            config = json.load(json_file)
            weather_config = config['weather']
            calendar_config = config['calendar']

        font = graphics.Font()
        font.LoadFont('fonts/5x7.bdf')

        weather_service = WeatherService(weather_config, font)
        datetime_service = DateTimeService(font)
        calendar_service = CalendarService(calendar_config)
        moon_service = MoonService(font)
        matrix = None
        day_mode = True

        try:
            print("Press CTRL-C to stop")

            while True:
                now = datetime.datetime.now()
                time_of_day = now.time()

                is_before = time_of_day < day_time
                is_after = time_of_day >= night_time

                if is_before or is_after:
                    matrix = None
                    start_time = datetime.datetime.combine(
                        datetime.datetime.today(), day_time)
                    if is_after:
                        start_time = start_time + datetime.timedelta(days=1)

                    sleep_seconds = (start_time - now).seconds
                    print("Sleeping for seconds: " + str(sleep_seconds))
                    time.sleep(sleep_seconds)

                if matrix == None:
                    matrix = self.matrix()
                    time.sleep(
                        1
                    )  # Just allows the time to tick past the start time safely

                if time_of_day < evening_time:
                    weather_service.process(matrix, 5)
                    calendar_service.process(matrix, 1, 3)
                    day_mode = True
                elif time_of_day < night_time:
                    moon_service.process(matrix, day_mode)
                    calendar_service.process(matrix, 5, 1)
                    day_mode = False

                datetime_service.process(matrix)
                time.sleep(0.1)

        except KeyboardInterrupt:
            print("Exiting\n")
            sys.exit(0)
 def __init__(self,
              longitude=-0.418,
              latitude=39.360,
              units=weatherservice.Units()):
     WeatherService.__init__(self, longitude, latitude, units)
     self.url = NOAA_WEATHER_URL % (self.latitude, self.longitude)
Example #11
0
	def __init__(self,longitude=-0.418, latitude=39.360, units = weatherservice.Units()):
		WeatherService.__init__(self,longitude,latitude,units)
		self.url = NOAA_WEATHER_URL % (self.latitude,self.longitude)