Added server detection

Implemented server detection at the request of NTEWIZ. If not detected, it will ask after collecting pull data.
This commit is contained in:
Golumpa 2026-07-16 01:34:38 +01:00
parent 9eae9b4a15
commit cc88955baf
15 changed files with 242 additions and 7 deletions

View file

@ -4,6 +4,8 @@ import os
import sys
from nte_history_exporter.constants import EXPORTER_VERSION, GAME_NAME
from nte_history_exporter.decoder.server_region import SERVER_REGIONS
from nte_history_exporter.live_capture.stop_key import wait_for_keypress
WIDTH = 58
REPOSITORY_URL = "https://github.com/Golumpa/nte-exporter"
@ -179,3 +181,30 @@ def prompt_user_uid() -> str | None:
print_note("Leaving this blank may prevent import on some trackers.")
value = input(" User UID: ").strip()
return value or None
def prompt_server_id() -> str | None:
print()
print_problem("Account server was not detected in this capture.")
print_note("Choose the server used by this account:")
choices = tuple(
(str(index), server_id, details["name"])
for index, (server_id, details) in enumerate(SERVER_REGIONS.items(), start=1)
)
for key, _server_id, name in choices:
print(f" {key}. {name}")
print_note("Leave this blank to omit server information.")
by_key = {key: server_id for key, server_id, _name in choices}
while True:
value = input(" Server [1-4]: ").strip()
if not value:
return None
if value in by_key:
return by_key[value]
print_problem("Enter 1, 2, 3, or 4; or leave it blank.")
def wait_for_close() -> None:
print()
print_success("Press any key to close the exporter.")
wait_for_keypress()