diff --git a/pyquake3.py b/pyquake3.py index 9b42674..a266c65 100755 --- a/pyquake3.py +++ b/pyquake3.py @@ -22,6 +22,16 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. import socket import re +bot_names = ['Crash', # Tier 0 + 'Ranger', 'Phobos', 'Mynx', 'Orbb', 'Sarge', # Tier 1 + 'Bitterman', 'Grunt', 'Hossman', 'Daemia', 'Hunter', # Tier 2 + 'Angel', 'Gorre', 'Klesk', 'Slash', 'Wrack', # Tier 3 + 'Biker', 'Lucy', 'Patriot', 'Tank Jr.', 'Anarki', # Tier 4 + 'Stripe', 'Razor', 'Keel', 'Visor', 'Uriel', # Tier 5 + 'Bones', 'Cadaver', 'Sorlag', 'Doom', 'Major', # Tier 6 + 'Xaero' # Tier 7 + ] + class Player: def __init__(self, name, frags, ping, address=None, bot=-1): self.name = name @@ -110,7 +120,10 @@ class PyQuake3: print 'couldnt match', player continue frags, ping, name = match.groups() - self.players.append(Player(name, frags, ping)) + if name in bot_names: + self.players.append(Player(name, frags, ping, bot=1)) + else: + self.players.append(Player(name, frags, ping, bot=0)) def update(self): cmd, data = self.command('getstatus') self.vars = self.parse_status(data) diff --git a/quake3_status.py b/quake3_status.py index d9aaa41..a7de122 100644 --- a/quake3_status.py +++ b/quake3_status.py @@ -21,9 +21,11 @@ def index(hours=None, minutes=None): q = PyQuake3(q3server, rcon_password) q.update() - data = 'The name of %s is %s, running map %s with %s player(s).' % \ - (q.get_address(), q.vars['sv_hostname'], \ - q.vars['mapname'], len(q.players)) + data = 'The name is %s, running map %s with %s human player(s) and %s bot(s).' % \ + (q.vars['sv_hostname'], \ + q.vars['mapname'], \ + len([x for x in q.players if not x.bot]),\ + len([x for x in q.players if x.bot])) return data diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..e3e9a71 --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +Flask