Skip to content
This repository has been archived by the owner on Jan 11, 2018. It is now read-only.

write some neat regexp to sort out the playerdata #2

Open
wwevo opened this issue Dec 19, 2017 · 2 comments
Open

write some neat regexp to sort out the playerdata #2

wwevo opened this issue Dec 19, 2017 · 2 comments

Comments

@wwevo
Copy link
Owner

wwevo commented Dec 19, 2017

fields and values, fields and values!!

@wwevo wwevo added the addition label Dec 19, 2017
@wwevo
Copy link
Owner Author

wwevo commented Dec 20, 2017

2017-12-20T15:19:34 37150.553 INF Executing command 'lp' by Telnet from 127.0.0.1:48194
0. id=293844, NemoTheTerrible, pos=(-31.4, 19.2, -5612.3), rot=(-75.9, -2700.0, 0.0), remote=True, health=196, deaths=42, zombies=2582, players=0, score=2372, level=200, steamid=76561198237200194, ip=197.234.149.102, ping=200
1. id=1516522, Cyborg Pirate Ninja Jesus, pos=(-2870.6, 108.3, 1802.0), rot=(-21.1, 1586.3, 0.0), remote=True, health=37, deaths=33, zombies=400, players=0, score=243, level=83, steamid=76561198084399656, ip=188.3.54.47, ping=51
2. id=1657080, pixiu Hellcase.com, pos=(-5651.3, 96.1, 8102.5), rot=(-26.7, -57.7, 0.0), remote=True, health=48, deaths=0, zombies=4, players=0, score=4, level=2, steamid=76561198404967309, ip=217.99.167.30, ping=56
3. id=1615908, hannesschmoschmannes, pos=(-2638.5, 39.3, 2708.5), rot=(-90.0, 354.4, 0.0), remote=True, health=56, deaths=7, zombies=114, players=0, score=79, level=35, steamid=76561198003209403, ip=79.200.233.46, ping=39
4. id=1459, Penny Blush, pos=(5482.0, 68.1, 5249.7), rot=(-40.2, -2211.3, 0.0), remote=True, health=212, deaths=3, zombies=2308, players=0, score=2293, level=148, steamid=76561198020235763, ip=184.153.202.112, ping=122
5. id=1613144, GogataBG, pos=(-5270.3, 98.7, 6653.6), rot=(-26.7, -88.6, 0.0), remote=True, health=31, deaths=34, zombies=78, players=0, score=0, level=23, steamid=76561198375205410, ip=87.126.176.217, ping=36
Total of 6 in the game

This is a typical response if players are present. I'd need an array containing all players each with their own data.
So a regexp and a function is needed t convert this to a database-ready (possibly orm) format

@wwevo
Copy link
Owner Author

wwevo commented Dec 20, 2017

\d{1,2}. id=(\d+), ([\w+]+), pos=\((.?\d+.\d), (.?\d+.\d), (.?\d+.\d)\), rot=\((.?\d+.\d), (.?\d+.\d), (.?\d+.\d)\), remote=(\w+), health=(\d+), deaths=(\d+), zombies=(\d+), players=(\d+), score=(\d+), level=(\d+), steamid=(\d+), ip=(\d+\.\d+\.\d+\.\d+), ping=(\d+)\n*

wrote A regexp, not a neat one. It works for now

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant