From ee8abac9a38e3ae3ad130091c4574041cc09cb65 Mon Sep 17 00:00:00 2001 From: Magic <82341152+MagicTheDev@users.noreply.github.com> Date: Mon, 29 Jan 2024 01:11:10 -0600 Subject: [PATCH] ClashKing v4 --- tracking/player/main.py | 25 ++++++++++++----------- tracking/player/{tracking.py => track.py} | 2 +- 2 files changed, 14 insertions(+), 13 deletions(-) rename tracking/player/{tracking.py => track.py} (99%) diff --git a/tracking/player/main.py b/tracking/player/main.py index 55e5ff6d..3289380f 100644 --- a/tracking/player/main.py +++ b/tracking/player/main.py @@ -3,19 +3,20 @@ from collections import deque from redis import asyncio as redis -from .config import Config -from .tracking import main -from ..utils import create_keys +from tracking.player.config import Config +from tracking.player.track import main +from tracking.utils import create_keys -config = Config() -loop = asyncio.get_event_loop() +if __name__ == "__main__": + config = Config() + loop = asyncio.get_event_loop() -stats_mongo_client = motor.motor_asyncio.AsyncIOMotorClient(config.stats_mongodb) -static_mongo_client = motor.motor_asyncio.AsyncIOMotorClient(config.static_mongodb) + stats_mongo_client = motor.motor_asyncio.AsyncIOMotorClient(config.stats_mongodb) + static_mongo_client = motor.motor_asyncio.AsyncIOMotorClient(config.static_mongodb) -redis_host = redis.Redis(host=config.redis_ip, port=6379, db=0, password=config.redis_pw, decode_responses=False, max_connections=2500) -keys = create_keys([f"apiclashofclans+test{x}@gmail.com" for x in range(config.min_coc_email, config.max_coc_email + 1)], [config.coc_password] * config.max_coc_email) -keys = deque(keys) -loop.create_task(main(keys=keys, cache=redis_host, stats_mongo_client=stats_mongo_client, static_mongo_client=static_mongo_client, config=config)) -loop.run_forever() + redis_host = redis.Redis(host=config.redis_ip, port=6379, db=0, password=config.redis_pw, decode_responses=False, max_connections=2500) + keys = create_keys([f"apiclashofclans+test{x}@gmail.com" for x in range(config.min_coc_email, config.max_coc_email + 1)], [config.coc_password] * config.max_coc_email) + keys = deque(keys) + loop.create_task(main(keys=keys, cache=redis_host, stats_mongo_client=stats_mongo_client, static_mongo_client=static_mongo_client, config=config)) + loop.run_forever() diff --git a/tracking/player/tracking.py b/tracking/player/track.py similarity index 99% rename from tracking/player/tracking.py rename to tracking/player/track.py index 00c9a05c..17457155 100644 --- a/tracking/player/tracking.py +++ b/tracking/player/track.py @@ -9,7 +9,7 @@ from msgspec.msgpack import decode from loguru import logger -from .utils import Player, get_player_changes, gen_legend_date, gen_season_date, gen_raid_date, gen_games_season +from tracking.player.utils import Player, get_player_changes, gen_legend_date, gen_season_date, gen_raid_date, gen_games_season from pymongo import InsertOne, UpdateOne