- Add pre-compiled regex pattern for color codes - Add SPECIAL_CHAR constant (chr(25)) for clarity - Move time import to module level in parser - Centralize color code stripping via strip_color_codes() - Make qlpycon.bash fully configurable (workdir, serverip) - Add validation checks for workdir and venv - Fix port numbers in help text (28960-28969)
67 lines
1.9 KiB
Bash
Executable File
67 lines
1.9 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
#
|
|
# Helper script to connect to different Quake Live servers
|
|
# Required: QLPYCON_PASSWORD
|
|
# Optional: QLPYCON_WORKDIR (default: /home/marc/git/qlpycon.git)
|
|
# QLPYCON_SERVERIP (default: 10.13.12.93)
|
|
|
|
# Required
|
|
password="${QLPYCON_PASSWORD:-}"
|
|
workdir="${QLPYCON_WORKDIR:-/home/marc/git/qlpycon.git}"
|
|
serverip="${QLPYCON_SERVERIP:-10.13.12.93}"
|
|
|
|
# Validate
|
|
if [ -z "$password" ]; then
|
|
echo "Error: QLPYCON_PASSWORD not set"
|
|
echo "Set: export QLPYCON_PASSWORD='your_password'"
|
|
exit 1
|
|
fi
|
|
|
|
if [ ! -d "$workdir" ]; then
|
|
echo "Error: Working directory does not exist: $workdir"
|
|
exit 1
|
|
fi
|
|
|
|
if [ ! -d "$workdir/venv" ]; then
|
|
echo "Error: venv not found in $workdir"
|
|
exit 1
|
|
fi
|
|
|
|
cd "$workdir" || exit 1
|
|
source venv/bin/activate
|
|
|
|
if [ "$1" == "ffa" ]; then
|
|
python3 main.py --host tcp://"$serverip":28960 --password "$password"
|
|
|
|
elif [ "$1" == "duel" ]; then
|
|
python3 main.py --host tcp://"$serverip":28961 --password "$password"
|
|
|
|
elif [ "$1" == "rcpma" ]; then
|
|
python3 main.py --host tcp://"$serverip":28962 --password "$password"
|
|
|
|
elif [ "$1" == "iffa" ]; then
|
|
python3 main.py --host tcp://"$serverip":28963 --password "$password"
|
|
|
|
elif [ "$1" == "ca" ]; then
|
|
python3 main.py --host tcp://"$serverip":28964 --password "$password"
|
|
|
|
elif [ "$1" == "ctf" ]; then
|
|
python3 main.py --host tcp://"$serverip":28965 --password "$password"
|
|
|
|
elif [ "$1" == "rcvq3" ]; then
|
|
python3 main.py --host tcp://"$serverip":28966 --password "$password"
|
|
|
|
elif [ "$1" == "test" ]; then
|
|
python3 main.py --host tcp://"$serverip":28967 --password "$password"
|
|
|
|
elif [ "$1" == "ft" ]; then
|
|
python3 main.py --host tcp://"$serverip":28968 --password "$password"
|
|
|
|
elif [ "$1" == "leduel" ]; then
|
|
python3 main.py --host tcp://"$serverip":28969 --password "$password"
|
|
|
|
else
|
|
echo "[ ffa (28960), duel (28961), rcpma (28962), iffa (28963), ca (28964), ctf (28965), rcvq3 (28966), test (28967), ft (28968), leduel (28969) ]"
|
|
|
|
fi
|