2024-08-31 06:01:55 +00:00
|
|
|
#!/usr/bin/env python3
|
2024-09-02 00:23:34 +00:00
|
|
|
#
|
|
|
|
# Copyright (C) 2024 Simon Howard
|
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or modify it
|
|
|
|
# under the terms of the GNU General Public License as published by the
|
|
|
|
# Free Software Foundation; either version 2 of the License, or (at your
|
|
|
|
# option) any later version. This program is distributed in the hope that
|
|
|
|
# it will be useful, but WITHOUT ANY WARRANTY; without even the implied
|
|
|
|
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
#
|
2024-08-31 06:01:55 +00:00
|
|
|
|
|
|
|
import os
|
2024-08-31 20:16:06 +00:00
|
|
|
from os.path import join
|
2024-08-31 06:01:55 +00:00
|
|
|
import shlex
|
|
|
|
import sys
|
|
|
|
|
2024-08-31 20:16:06 +00:00
|
|
|
from common import *
|
2024-08-31 06:01:55 +00:00
|
|
|
|
2024-08-31 20:16:27 +00:00
|
|
|
source_port = os.getenv("SOURCE_PORT")
|
|
|
|
assert source_port != "", "SOURCE_PORT environment variable not set."
|
2024-08-31 06:01:55 +00:00
|
|
|
lmp_file, out_file = sys.argv[1:]
|
|
|
|
cfg = read_config(lmp_file)
|
|
|
|
|
|
|
|
args = [
|
2024-09-01 04:10:58 +00:00
|
|
|
source_port,
|
|
|
|
"-iwad", join("iwads", cfg["iwad"]),
|
2024-08-31 06:01:55 +00:00
|
|
|
"-statdump", out_file,
|
|
|
|
"-timedemo", lmp_file,
|
2024-08-31 06:09:35 +00:00
|
|
|
] + shlex.split(os.getenv("DOOMOPTS", ""))
|
2024-08-31 06:01:55 +00:00
|
|
|
|
2024-08-31 23:25:14 +00:00
|
|
|
if "gameversion" in cfg:
|
|
|
|
args.extend(("-gameversion", cfg["gameversion"]))
|
|
|
|
|
2024-08-31 06:01:55 +00:00
|
|
|
if "pwad" in cfg:
|
|
|
|
args.extend(("-file", join("extract", cfg["pwad"])))
|
|
|
|
|
2024-09-01 04:00:13 +00:00
|
|
|
command = shlex.join(args) + " >/dev/null 2>&1"
|
|
|
|
print(command)
|
|
|
|
os.system(command)
|