4 Commits

Author SHA1 Message Date
71401c32f9 include the mapname in the status output
patch bump
2026-02-21 12:37:10 +00:00
1cee478197 remove trailing space 2026-02-20 18:21:04 +00:00
fcc91b7e34 patch bump 2026-02-20 18:20:11 +00:00
9b3ae629f3 include the command in the error message 2026-02-20 18:19:57 +00:00
3 changed files with 24 additions and 22 deletions

View File

@@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: 2026-present onyx-and-iris <code@onyxandiris.online> # SPDX-FileCopyrightText: 2026-present onyx-and-iris <code@onyxandiris.online>
# #
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
__version__ = '0.5.0' __version__ = '0.5.2'

View File

@@ -70,7 +70,7 @@ class RconApp(App):
) )
except RCONError: except RCONError:
output = ( output = (
'Unable to execute command.', f'Unable to execute command {cmd}.',
'It may be due to a map change or a server restart.', 'It may be due to a map change or a server restart.',
'If the problem persists, please check your connection settings and ensure the server is running.', 'If the problem persists, please check your connection settings and ensure the server is running.',
) )

View File

@@ -10,6 +10,7 @@ Renderable = Text | Table | str
class Writable: class Writable:
RE_COLOR_CODES = re.compile(r'\^[0-9]') RE_COLOR_CODES = re.compile(r'\^[0-9]')
RE_MAP_FROM_STATUS = re.compile(r'^map: (?P<mapname>mp_[a-z_]+)$')
RE_PLAYER_FROM_STATUS = re.compile( RE_PLAYER_FROM_STATUS = re.compile(
r'^\s*(?P<slot>[0-9]+)\s+' r'^\s*(?P<slot>[0-9]+)\s+'
r'(?P<score>[0-9-]+)\s+' r'(?P<score>[0-9-]+)\s+'
@@ -62,32 +63,33 @@ class Writable:
table.add_column('GUID', justify='center') table.add_column('GUID', justify='center')
table.add_column('Name', justify='center') table.add_column('Name', justify='center')
table.add_column('Last', justify='center') table.add_column('Last', justify='center')
table.add_column('IP', justify='center') table.add_column('IP:Port', justify='center')
table.add_column('Port', justify='center')
table.add_column('QPort', justify='center') table.add_column('QPort', justify='center')
table.add_column('Rate', justify='center') table.add_column('Rate', justify='center')
mapname = ''
for line in status_response.splitlines(): for line in status_response.splitlines():
match self.RE_PLAYER_FROM_STATUS.match(line): if m := self.RE_PLAYER_FROM_STATUS.match(line):
case None: table.add_row(
continue m.group('slot'),
case m: m.group('score'),
table.add_row( m.group('ping'),
m.group('slot'), m.group('guid'),
m.group('score'), self.remove_color_codes(m.group('name')),
m.group('ping'), m.group('last'),
m.group('guid'), f'{m.group("ip")}:{m.group("port")}',
self.remove_color_codes(m.group('name')), m.group('qport'),
m.group('last'), m.group('rate'),
m.group('ip'), )
m.group('port'), elif m := self.RE_MAP_FROM_STATUS.match(line):
m.group('qport'), mapname = m.group('mapname')
m.group('rate'),
)
out = Text(f'Map: {mapname}\n', style='bold #88c0d0')
if len(table.rows) == 0: if len(table.rows) == 0:
return 'No players connected.' return out.append('No players connected', style='#c73d4b')
return table else:
table.title = out
return table
def cvar_table(self, m: re.Match) -> Table: def cvar_table(self, m: re.Match) -> Table:
table = Table(show_header=True, header_style='bold #88c0d0') table = Table(show_header=True, header_style='bold #88c0d0')