diff options
-rwxr-xr-x | async_bot.py | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/async_bot.py b/async_bot.py index 5f33f7e..7306753 100755 --- a/async_bot.py +++ b/async_bot.py | |||
@@ -31,7 +31,10 @@ DBHost = '' | |||
31 | BlockList = '' | 31 | BlockList = '' |
32 | LOG_FILENAME = 'voh.log' | 32 | LOG_FILENAME = 'voh.log' |
33 | TIME_ZONE='Asia/Shanghai' | 33 | TIME_ZONE='Asia/Shanghai' |
34 | 34 | minLngE6 = 0 | |
35 | minLatE6 = 0 | ||
36 | maxLngE6 = 0 | ||
37 | maxLatE6 = 0 | ||
35 | 38 | ||
36 | class CookieException(Exception): | 39 | class CookieException(Exception): |
37 | pass | 40 | pass |
@@ -53,6 +56,10 @@ def read_config(): | |||
53 | global DBHost | 56 | global DBHost |
54 | global BlockList | 57 | global BlockList |
55 | global LOG_FILENAME | 58 | global LOG_FILENAME |
59 | global minLngE6 | ||
60 | global minLatE6 | ||
61 | global maxLngE6 | ||
62 | global maxLatE6 | ||
56 | 63 | ||
57 | configfile = open("./config.json") | 64 | configfile = open("./config.json") |
58 | config = json.load(configfile) | 65 | config = json.load(configfile) |
@@ -66,6 +73,10 @@ def read_config(): | |||
66 | DBPass = config["DBPass"] | 73 | DBPass = config["DBPass"] |
67 | DBHost = config["DBHost"] | 74 | DBHost = config["DBHost"] |
68 | BlockList = config["BlockList"] | 75 | BlockList = config["BlockList"] |
76 | minLngE6 = config["minLngE6"] | ||
77 | minLatE6 = config["minLatE6"] | ||
78 | maxLngE6 = config["maxLngE6"] | ||
79 | maxLatE6 = config["maxLatE6"] | ||
69 | 80 | ||
70 | os.environ['TZ'] = TIME_ZONE | 81 | os.environ['TZ'] = TIME_ZONE |
71 | time.tzset() | 82 | time.tzset() |
@@ -174,12 +185,12 @@ def insert_message_to_database(time, id, msg): | |||
174 | def main(): | 185 | def main(): |
175 | logger = logging.getLogger('main') | 186 | logger = logging.getLogger('main') |
176 | 187 | ||
177 | # Lat Lng of Hangzhou | 188 | # Lat & Lng of fetch region |
178 | field = { | 189 | field = { |
179 | 'minLngE6': 119618783, | 190 | 'minLngE6': minLngE6, |
180 | 'minLatE6': 29912919, | 191 | 'minLatE6': minLatE6, |
181 | 'maxLngE6': 121018722, | 192 | 'maxLngE6': maxLngE6, |
182 | 'maxLatE6': 30573739, | 193 | 'maxLatE6': maxLatE6, |
183 | } | 194 | } |
184 | 195 | ||
185 | mints = -1 | 196 | mints = -1 |