From 0aa86516fb9da810664e93f510a814c0ef867835 Mon Sep 17 00:00:00 2001 From: Bad Wolf Date: Thu, 12 Jan 2023 19:00:35 -0400 Subject: [PATCH 1/5] Adding code to support configurable removal time return count1 + count2 --- config_example/config.ini | 1 + stop_watcher.py | 2 +- util/config.py | 5 ++--- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/config_example/config.ini b/config_example/config.ini index 87ddcf8..435a352 100644 --- a/config_example/config.ini +++ b/config_example/config.ini @@ -1,6 +1,7 @@ [Config] language = en/de/fr/es/pl/pt portal_scraper_interval = 3600 +removed_stop_wait = 172800 [Maps] static_map = True diff --git a/stop_watcher.py b/stop_watcher.py index 4486d1f..8293afc 100644 --- a/stop_watcher.py +++ b/stop_watcher.py @@ -187,7 +187,7 @@ def check_edits(fil, wp, w_type, w_id, w_lat, w_lon, w_name, w_img): deleted_max_portals = 5 deleted_timespan_portals = ((4*config.scraper_wait) / 60) deleted_max_stops = 5 - deleted_timespan_stops = 300 + deleted_timespan_stops = ((4*config.removed_wait) / 60) if "deleted" in fil: if "max" in fil["deleted"]: if "scraper" in fil["deleted"]["max"]: diff --git a/util/config.py b/util/config.py index af0b60e..18625b1 100644 --- a/util/config.py +++ b/util/config.py @@ -8,7 +8,7 @@ def __init__(self, config_path): self.language = config_file.get("Config", "language").lower() self.scraper_wait = config_file.getint("Config", "portal_scraper_interval") - + self.removed_wait = config_file.getint("Config", "removed_stop_wait") self.use_static_map = config_file.getboolean("Maps", "static_map") self.static_provider = config_file.get("Maps", "static_map_provider").lower() @@ -21,7 +21,6 @@ def __init__(self, config_path): self.map_url = config_file.get("Maps", "map_url") self.map_provider = config_file.get("Maps", "frontend").lower() self.map_name = config_file.get("Maps", "map_name") - self.geojson = config_file.getboolean("Maps", "geojson") self.use_geocoding = config_file.getboolean("Maps", "geocoding") self.geocoding_provider = config_file.get("Maps", "geocoding_provider").lower() @@ -40,4 +39,4 @@ def __init__(self, config_path): self.portal_db_host = config_file.get("DB", "portal_host", fallback=self.db_host) self.portal_db_port = config_file.getint("DB", "portal_port", fallback=self.db_port) self.portal_db_user = config_file.get("DB", "portal_user", fallback=self.db_user) - self.portal_db_password = config_file.get("DB", "portal_password", fallback=self.db_password) + self.portal_db_password = config_file.get("DB", "portal_password", fallback=self.db_password) \ No newline at end of file From 05a337d690956c01fb324e85ef00d6cd43f933c3 Mon Sep 17 00:00:00 2001 From: Bad Wolf Date: Thu, 12 Jan 2023 20:02:38 -0400 Subject: [PATCH 2/5] Update config.ini set default to 3600 which = 60 mins --- config_example/config.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config_example/config.ini b/config_example/config.ini index 435a352..d37c7e1 100644 --- a/config_example/config.ini +++ b/config_example/config.ini @@ -1,7 +1,7 @@ [Config] language = en/de/fr/es/pl/pt portal_scraper_interval = 3600 -removed_stop_wait = 172800 +removed_stop_wait = 3600 [Maps] static_map = True From b683dfe0874f32362ef626490fdd46b84faef440 Mon Sep 17 00:00:00 2001 From: Bad Wolf Date: Fri, 13 Jan 2023 09:55:14 -0400 Subject: [PATCH 3/5] fixed config.py for accidental removal of geojson --- util/config.py | 1 + 1 file changed, 1 insertion(+) diff --git a/util/config.py b/util/config.py index 18625b1..4911a90 100644 --- a/util/config.py +++ b/util/config.py @@ -21,6 +21,7 @@ def __init__(self, config_path): self.map_url = config_file.get("Maps", "map_url") self.map_provider = config_file.get("Maps", "frontend").lower() self.map_name = config_file.get("Maps", "map_name") + self.geojson = config_file.getboolean("Maps", "geojson") self.use_geocoding = config_file.getboolean("Maps", "geocoding") self.geocoding_provider = config_file.get("Maps", "geocoding_provider").lower() From d9392e85e3c521d3cfd5f4d2380a8e0a0b81ae4e Mon Sep 17 00:00:00 2001 From: Bad Wolf Date: Fri, 13 Jan 2023 10:08:24 -0400 Subject: [PATCH 4/5] added fallbacks for newer config items --- util/config.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/util/config.py b/util/config.py index 4911a90..f8baa15 100644 --- a/util/config.py +++ b/util/config.py @@ -8,7 +8,7 @@ def __init__(self, config_path): self.language = config_file.get("Config", "language").lower() self.scraper_wait = config_file.getint("Config", "portal_scraper_interval") - self.removed_wait = config_file.getint("Config", "removed_stop_wait") + self.removed_wait = config_file.getint("Config", "removed_stop_wait", fallback=3600) self.use_static_map = config_file.getboolean("Maps", "static_map") self.static_provider = config_file.get("Maps", "static_map_provider").lower() @@ -21,7 +21,7 @@ def __init__(self, config_path): self.map_url = config_file.get("Maps", "map_url") self.map_provider = config_file.get("Maps", "frontend").lower() self.map_name = config_file.get("Maps", "map_name") - self.geojson = config_file.getboolean("Maps", "geojson") + self.geojson = config_file.getboolean("Maps", "geojson", fallback= False) self.use_geocoding = config_file.getboolean("Maps", "geocoding") self.geocoding_provider = config_file.get("Maps", "geocoding_provider").lower() From e181756c2ec16a4115933021655847f69291cce5 Mon Sep 17 00:00:00 2001 From: Bad Wolf Date: Fri, 13 Jan 2023 12:52:44 -0400 Subject: [PATCH 5/5] corrected default fallback to match # of hours correctly --- util/config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/config.py b/util/config.py index f8baa15..20c0aa1 100644 --- a/util/config.py +++ b/util/config.py @@ -8,7 +8,7 @@ def __init__(self, config_path): self.language = config_file.get("Config", "language").lower() self.scraper_wait = config_file.getint("Config", "portal_scraper_interval") - self.removed_wait = config_file.getint("Config", "removed_stop_wait", fallback=3600) + self.removed_wait = config_file.getint("Config", "removed_stop_wait", fallback=18000) self.use_static_map = config_file.getboolean("Maps", "static_map") self.static_provider = config_file.get("Maps", "static_map_provider").lower()