47 lines
1.3 KiB
Python
47 lines
1.3 KiB
Python
import os
|
|
import sys
|
|
import argparse
|
|
from dotenv import load_dotenv
|
|
import mysql.connector
|
|
|
|
# Add the project root to the Python path
|
|
project_root = os.path.dirname(os.path.abspath(__file__))
|
|
sys.path.append(project_root)
|
|
|
|
from ktvmanager.lib.checker import single_account_check
|
|
from ktvmanager.lib.get_urls import get_latest_urls_from_dns
|
|
|
|
|
|
def main() -> None:
|
|
"""Debugs a single KTV account by checking its validity against available stream URLs."""
|
|
parser = argparse.ArgumentParser(description="Debug a single KTV account.")
|
|
parser.add_argument("username", help="The username to check.")
|
|
parser.add_argument("password", help="The password to check.")
|
|
args = parser.parse_args()
|
|
|
|
load_dotenv()
|
|
|
|
db_connection = mysql.connector.connect(
|
|
host=os.getenv("DBHOST"),
|
|
user=os.getenv("DBUSER"),
|
|
password=os.getenv("DBPASS"),
|
|
database=os.getenv("DATABASE"),
|
|
port=os.getenv("DBPORT"),
|
|
)
|
|
|
|
stream_urls = get_latest_urls_from_dns()
|
|
|
|
account_data = {"username": args.username, "password": args.password}
|
|
|
|
result = single_account_check(account_data, stream_urls)
|
|
|
|
if result:
|
|
print(f"Account {args.username} is VALID.")
|
|
else:
|
|
print(f"Account {args.username} is INVALID.")
|
|
|
|
db_connection.close()
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main() |