项目重构

This commit is contained in:
2025-12-28 16:59:29 +08:00
parent 6ad3e9f1f4
commit 4aa014aff0
8 changed files with 378 additions and 99 deletions
+10 -11
View File
@@ -11,7 +11,8 @@ from tqdm import tqdm
from src.My_Logger.project_logger import LoggerClass
from src.PostgresSQL.databaseHandler import DatabaseHandler
from src.utils.utils import load_config, size_of_file
from src.utils.utils import size_of_file
from src.config.load_config import project_config
project_path = Path(__file__).parent.parent.parent.absolute()
data_path = os.path.join(project_path, 'data')
@@ -40,9 +41,9 @@ def process_message_text(text):
class MessageUploader:
def __init__(self, config_path, local_logger, local_load_path, local_file_db_path, size_limit=0.5):
def __init__(self, local_logger, local_load_path, local_file_db_path, size_limit=0.5):
self.logger = local_logger
self.config = load_config(config_path)
self.config = project_config
self.load_path = local_load_path
self.file_param_list = ['photo', 'file']
self.db_handler = DatabaseHandler(self.config, self.logger)
@@ -196,14 +197,12 @@ def upload_didi_saved_message_to_db():
if __name__ == "__main__":
config = load_config(config_path)
config['database'] = "TestDB"
tg = MessageUploader(config_path=config_path,
local_logger=LoggerClass().get_log(logging.DEBUG),
local_load_path='E:\\SNSFiles\\ChatExport_2024-07-10',
local_file_db_path=config['file_db_path'],
size_limit=0.25)
tg = MessageUploader(
local_logger=LoggerClass().get_log(logging.DEBUG),
local_load_path='E:\\SNSFiles\\ChatExport_2024-07-10',
local_file_db_path=project_config['file_db_path'],
size_limit=0.25
)
try:
tg.do_upload()
# tg.logger_test()