def __init__(self, name, google_key, locale, units, timezone, time_limit, max_attempts, location, cache_type, geofence_file, debug): # Set the name of the Manager self.name = str(name).lower() self._log = self._create_logger(self.name) self._rule_log = self.get_child_logger('rules') self.__debug = debug # Get the Google Maps AP# TODO: Improve error checking self._google_key = None self._gmaps_service = None if str(google_key).lower() != 'none': self._google_key = google_key self._gmaps_service = GMaps(google_key) self._gmaps_reverse_geocode = False self._gmaps_distance_matrix = set() self._language = locale self.__locale = Locale(locale) # Setup the language-specific stuff self.__units = units # type of unit used for distances self.__timezone = timezone # timezone for time calculations self.__time_limit = time_limit # Minimum time remaining # Location should be [lat, lng] (or None for no location) self.__location = None if str(location).lower() != 'none': self.set_location(location) else: self._log.warning("NO LOCATION SET - this may cause issues " "with distance related DTS.") # Create cache self.__cache = cache_factory(self, cache_type) # Load and Setup the Pokemon Filters self._mons_enabled, self._mon_filters = False, OrderedDict() self._stops_enabled, self._stop_filters = False, OrderedDict() self._gyms_enabled, self._gym_filters = False, OrderedDict() self._ignore_neutral = False self._eggs_enabled, self._egg_filters = False, OrderedDict() self._raids_enabled, self._raid_filters = False, OrderedDict() self._weather_enabled, self._weather_filters = False, OrderedDict() # Create the Geofences to filter with from given file self.geofences = None if str(geofence_file).lower() != 'none': self.geofences = load_geofence_file(get_path(geofence_file)) # Create the alarms to send notifications out with self._alarms = {} self._max_attempts = int(max_attempts) # TODO: Move to alarm level # Initialize Rules self.__mon_rules = {} self.__stop_rules = {} self.__gym_rules = {} self.__egg_rules = {} self.__raid_rules = {} self.__weather_rules = {} # Initialize the queue and start the process self.__queue = Queue() self.__event = Event() self.__process = None
def __init__(self, name, google_key, locale, units, timezone, time_limit, max_attempts, location, quiet, cache_type, filter_file, geofence_file, alarm_file, debug): # Set the name of the Manager self.__name = str(name).lower() log.info("----------- Manager '{}' ".format(self.__name) + " is being created.") self.__debug = debug # Get the Google Maps API self.__google_key = google_key self.__loc_service = location_service_factory("GoogleMaps", self.__google_key, locale, units) self.__locale = Locale(locale) # Setup the language-specific stuff self.__units = units # type of unit used for distances self.__timezone = timezone # timezone for time calculations self.__time_limit = time_limit # Minimum time remaining # Location should be [lat, lng] (or None for no location) self.__location = None if str(location).lower() != 'none': self.set_location(location) else: log.warning("NO LOCATION SET - " + " this may cause issues with distance related DTS.") # Quiet mode self.__quiet = quiet # Create cache self.__cache = cache_factory(cache_type, self.__name) # Load and Setup the Pokemon Filters self.__mons_enabled, self.__mon_filters = False, OrderedDict() self.__stops_enabled, self.__stop_filters = False, OrderedDict() self.__gyms_enabled, self.__gym_filters = False, OrderedDict() self.__ignore_neutral = False self.__eggs_enabled, self.__egg_filters = False, OrderedDict() self.__raids_enabled, self.__raid_filters = False, OrderedDict() self.__weather_enabled, self.__weather_filters = False, OrderedDict() self.__quest_enabled, self.__quest_filters = False, OrderedDict() self.load_filter_file(get_path(filter_file)) # Create the Geofences to filter with from given file self.geofences = None if str(geofence_file).lower() != 'none': self.geofences = load_geofence_file(get_path(geofence_file)) # Create the alarms to send notifications out with self.__alarms = [] self.load_alarms_file(get_path(alarm_file), int(max_attempts)) # Initialize Rules self.__mon_rules = {} self.__stop_rules = {} self.__gym_rules = {} self.__egg_rules = {} self.__raid_rules = {} self.__weather_rules = {} self.__quest_rules = {} # Initialize the queue and start the process self.__queue = Queue() self.__event = Event() self.__process = None log.info("----------- Manager '{}' ".format(self.__name) + " successfully created.")
def __init__(self, name, google_key, locale, units, timezone, time_limit, max_attempts, location, cache_type, geofence_file, debug): # Set the name of the Manager self.name = str(name).lower() self._log = self._create_logger(self.name) self._rule_log = self.get_child_logger('rules') self.__debug = debug # Get the Google Maps AP# TODO: Improve error checking self._google_key = None self._gmaps_service = None if str(google_key).lower() != 'none': self._google_key = google_key self._gmaps_service = GMaps(google_key) self._gmaps_reverse_geocode = False self._gmaps_distance_matrix = set() self._language = locale self.__locale = Locale(locale) # Setup the language-specific stuff self.__units = units # type of unit used for distances self.__timezone = timezone # timezone for time calculations self.__time_limit = time_limit # Minimum time remaining # Location should be [lat, lng] (or None for no location) self.__location = None if str(location).lower() != 'none': self.set_location(location) else: self._log.warning( "NO LOCATION SET - this may cause issues " "with distance related DTS.") # Create cache self.__cache = cache_factory(self, cache_type) # Load and Setup the Pokemon Filters self._mons_enabled, self._mon_filters = False, OrderedDict() self._stops_enabled, self._stop_filters = False, OrderedDict() self._gyms_enabled, self._gym_filters = False, OrderedDict() self._ignore_neutral = False self._eggs_enabled, self._egg_filters = False, OrderedDict() self._raids_enabled, self._raid_filters = False, OrderedDict() self._weather_enabled, self._weather_filters = False, OrderedDict() # Create the Geofences to filter with from given file self.geofences = None if str(geofence_file).lower() != 'none': self.geofences = load_geofence_file(get_path(geofence_file)) # Create the alarms to send notifications out with self._alarms = {} self._max_attempts = int(max_attempts) # TODO: Move to alarm level # Initialize Rules self.__mon_rules = {} self.__stop_rules = {} self.__gym_rules = {} self.__egg_rules = {} self.__raid_rules = {} self.__weather_rules = {} # Initialize the queue and start the process self.__queue = Queue() self.__event = Event() self.__process = None