UOSA stats in Conky

Post Reply
Stuck
UOSA Donor!!
UOSA Donor!!
Posts: 324
Joined: Mon Aug 10, 2009 9:25 pm

UOSA stats in Conky

Post by Stuck »

I guess this is the most appropriate place to post this. Here is something I hacked up very quickly. It's a way of displaying UOSA stats on your conky setup. If you don't know what conky is, I highly recommend looking into it for nerd points.

It works by polling myUOSA every couple of minutes with curl, and then setting up a grep pipeline to extract the desired data. It's very hacky and not very efficient, but it will allow you to display the current number of players online as well as the time of the next event on your conky window.

Players Online:

Code: Select all

Players: ${texeci 1800 curl -s http://my.uosecondage.com/Status | grep -m 1 -oE "Players Online: [0-9]+" | grep -oE "[0-9]+"} online
Next Event:

Code: Select all

Next Event: ${texeci 1800 curl -s http://my.uosecondage.com/Events/Schedule | grep -m 1 -oE "[0-9]+:[0-9]+[apm]+"}
These should be inserted into your ~/.conkyrc file, under the TEXT section. (See: http://conky.sourceforge.net/documentation.html for more info). You also obviously need curl installed.

Warning: Do not set the polling intervals to anything lower than what they are. It will be spawning a bunch of threads for no reason and it's already inefficient on top of that. Furthermore, I'm sure Derrick doesn't want people polling myUOSA every 2 seconds. As it stands right now, I have the polling intervals set at 30 minutes, which I think is reasonable. I will not be held responsible for whatever happens to anyone's machine if you do something less than intelligent.

User avatar
Derrick
Posts: 9004
Joined: Thu Dec 13, 2007 7:49 pm
Location: Cove
Contact:

Re: UOSA stats in Conky

Post by Derrick »

I think the new website broke this :(

The stats are now coming from a soon to be new joinUO service.
This will grab the shard stats as a json: http://api.joinuo.com/api/status/bf8d24 ... 827f9f6a1b

Sample:
{"Chars":190142,"Clients":530,"isOnline":true,"Items":7994272,"PollTime":"2012-04-09T20:25:16.6706328Z","Uptime":"09:04:41","Ver":2}

The json format and location of this service are still pretty preliminary; I'll repost when it's final.

Correction: Misread the OP, this is using the myUOSA status page, but the web api may be a better place to snatch the stats from, and feel free to poll every few seconds.
Last edited by Derrick on Wed Apr 25, 2012 11:36 pm, edited 3 times in total.
Reason: oops
Image
"The text in this article or section may be incoherent or very hard to understand, and should be reworded if the intended meaning can be determined."

Stuck
UOSA Donor!!
UOSA Donor!!
Posts: 324
Joined: Mon Aug 10, 2009 9:25 pm

Re: UOSA stats in Conky

Post by Stuck »

Derrick wrote:The stats are now coming from a soon to be new joinUO service.
This will grab the shard stats as a json: http://api.joinuo.com/api/status/bf8d24 ... 827f9f6a1b

Sample:
{"Chars":190142,"Clients":530,"isOnline":true,"Items":7994272,"PollTime":"2012-04-09T20:25:16.6706328Z","Uptime":"09:04:41","Ver":2}
This is really cool. This will be even better for conky stats. Unfortunately, there's no real omnipresent command-line tool for parsing json, but it's still possible to `sed` or `awk` it.

User avatar
Derrick
Posts: 9004
Joined: Thu Dec 13, 2007 7:49 pm
Location: Cove
Contact:

Re: UOSA stats in Conky

Post by Derrick »

If you need a better format I'd be happy to provide. Let me know :)
Image
"The text in this article or section may be incoherent or very hard to understand, and should be reworded if the intended meaning can be determined."

Post Reply

Return to “Linux/Mac Support”