from pathlib import Path

from models.xtoken import XToken
from db_init import ensure_tables

if __name__ == '__main__':

    ensure_tables()

    file_path = Path(__file__).parent / '卡密信息-499251204164220357.txt'
    with open(file_path, 'r', encoding='utf-8') as f:
        content = f.read()

    tasks = []  # 创建任务列表
    lines = content.split('\n')

    n = 0
    for _, line in enumerate(lines):
        print(line.split('----'))


        XToken.get_or_create(
            user_name = line.split('----')[0],
            password = line.split('----')[1],
            email = line.split('----')[2],
            two_fa = line.split('----')[-2],
            token = line.split('----')[-1],
            # email_pwd = line.split('----')[1],
        )
