Clan Leaderboard

Reviving the EA/DICE/PunkBuster patch updating experience!
User avatar
Mort
Alpha-Forum Whore
Alpha-Forum Whore
Posts: 4232
Joined: Thu Dec 01, 2005 10:40 pm

Clan Leaderboard

Postby Mort » Sun Mar 14, 2010 11:08 am

Many thanks to Piers for sorting this out.

You can view the Clan BuddaBudda Leaderboard at the following location. I've also added a "Handy Link" on the front page for reference
http://www.buddabudda.com/stats/bfbc2/stats.htm

Direct link to the hosting site
http://bfbcs.com/stats_lb/1013754

User avatar
Piers
Comfortable with my sexuality
Comfortable with my sexuality
Posts: 1408
Joined: Fri Dec 02, 2005 7:57 am
Location: Horse country

Re: Clan Leaderboard

Postby Piers » Thu Dec 30, 2010 5:31 pm

Stats are back online (although slow).
I've updated everyone's stats - it seems to not be recording Vietnam achievements properly and is known to not be tracknig dog tags on purpose atm, but at least they're back.
Image

User avatar
Piers
Comfortable with my sexuality
Comfortable with my sexuality
Posts: 1408
Joined: Fri Dec 02, 2005 7:57 am
Location: Horse country

Re: Clan Leaderboard

Postby Piers » Thu Dec 30, 2010 7:06 pm

Oh, we ought to set up a daily job - at some quiet moment of the night - to queue everyone's stats, here's the API call:

Code: Select all

http://api.bfbcs.com/api/pc?players=[comma-sep-list]&fields=all


For us, I guess that would be:

Code: Select all

http://api.bfbcs.com/api/pc?players=dissoluteSwine,dQx-BC2,Mort_42,DJDrDamage,[BB]%20DeltaM6,[BB]%20KRaM,Celtic%20Fist,[BB]%20Mayhem&fields=all


Scott, can you set that up and see if it works? It definitely returns the JSON data for all 8 names but, had them all appended with "queue":false
Image

User avatar
Mort
Alpha-Forum Whore
Alpha-Forum Whore
Posts: 4232
Joined: Thu Dec 01, 2005 10:40 pm

Re: Clan Leaderboard

Postby Mort » Thu Dec 30, 2010 10:17 pm

What do you want me to do with it? Run it as a scheduled call with the output going into a database?
Image

User avatar
Piers
Comfortable with my sexuality
Comfortable with my sexuality
Posts: 1408
Joined: Fri Dec 02, 2005 7:57 am
Location: Horse country

Re: Clan Leaderboard

Postby Piers » Fri Dec 31, 2010 7:35 am

Just run it as a scheduled call - I wasn't planning on putting the output into a database as the btbcs site already has all the interface requirements we'd want (except maybe last day/last week awards)
Image

User avatar
Mort
Alpha-Forum Whore
Alpha-Forum Whore
Posts: 4232
Joined: Thu Dec 01, 2005 10:40 pm

Re: Clan Leaderboard

Postby Mort » Fri Dec 31, 2010 9:54 am

So are you able to chuck together a few lines of php/cgi/.net/wotever code that can do that for me?
Image

User avatar
Piers
Comfortable with my sexuality
Comfortable with my sexuality
Posts: 1408
Joined: Fri Dec 02, 2005 7:57 am
Location: Horse country

Re: Clan Leaderboard

Postby Piers » Sat Jan 01, 2011 5:50 pm

yup.
Image

User avatar
Piers
Comfortable with my sexuality
Comfortable with my sexuality
Posts: 1408
Joined: Fri Dec 02, 2005 7:57 am
Location: Horse country

Re: Clan Leaderboard

Postby Piers » Sun Jan 02, 2011 3:35 pm

Here you are:

Code: Select all

<?php
$url = 'http://api.bfbcs.com/api/pc';
$postdata = 'players=dissoluteSwine,dQx-BC2,Mort_42,DJDrDamage,[BB]%20DeltaM6,[BB]%20KRaM,Celtic%20Fist,[BB]%20Mayhem&fields=all';

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata);
$data = curl_exec($ch);
curl_close($ch);

$data = json_decode($data,true);

print_r($data);

?>
Image

User avatar
Mort
Alpha-Forum Whore
Alpha-Forum Whore
Posts: 4232
Joined: Thu Dec 01, 2005 10:40 pm

Re: Clan Leaderboard

Postby Mort » Sun Jan 02, 2011 9:36 pm

It doesn't seem to do a lot. Should I be expecting some output from it at all? The only thing I get is an exit code of 255 which doesn't seem right.

Do I need to have enabled some extra php modules or anything?
Image

User avatar
Piers
Comfortable with my sexuality
Comfortable with my sexuality
Posts: 1408
Joined: Fri Dec 02, 2005 7:57 am
Location: Horse country

Re: Clan Leaderboard

Postby Piers » Sun Jan 02, 2011 10:06 pm

Mort wrote:It doesn't seem to do a lot. Should I be expecting some output from it at all? The only thing I get is an exit code of 255 which doesn't seem right.

Do I need to have enabled some extra php modules or anything?



Search me...

If I run the URL in my browser I get a mountain of data (or I did, maybe they've turned the api calls off?). I've just used the php code from the api, suitably edited.
Maybe it would be easier to have a scheduled event to simply call the URL?
Image

User avatar
Piers
Comfortable with my sexuality
Comfortable with my sexuality
Posts: 1408
Joined: Fri Dec 02, 2005 7:57 am
Location: Horse country

Re: Clan Leaderboard

Postby Piers » Sun Jan 02, 2011 11:12 pm

I just checked - the api call definitely works as the URL(and queued updates, yay!). I don't have php installed so I can't test that code.

Ahhh, you probably don't have the json_decode module.

Just remove this line of code:

Code: Select all

$data = json_decode($data,true);
Image

User avatar
Mort
Alpha-Forum Whore
Alpha-Forum Whore
Posts: 4232
Joined: Thu Dec 01, 2005 10:40 pm

Re: Clan Leaderboard

Postby Mort » Mon Jan 03, 2011 12:04 am

It worked for me as a URL in my browser as well. From what I can tell JSON needs a newer version of PHP than I've currently got installed. I'm still trying to find the time and motivation to move everything over to a new server that has updated version of everything but haven't had time to do it and test properly.

Took out the JSON line but still the same thing.
Image

User avatar
Piers
Comfortable with my sexuality
Comfortable with my sexuality
Posts: 1408
Joined: Fri Dec 02, 2005 7:57 am
Location: Horse country

Re: Clan Leaderboard

Postby Piers » Mon Jan 03, 2011 9:46 pm

If you're still using the php install you used for 2142, you could try this, the 2142 script uses file() instead of curl() so maybe curl() postdates your version as well.

Code: Select all

<?php
$theURI = 'http://api.bfbcs.com/api/pc';
$theparams = 'players=dissoluteSwine,dQx-BC2,Mort_42,DJDrDamage,[BB]%20DeltaM6,[BB]%20KRaM,Celtic%20Fist,[BB]%20Mayhem&fields=all';
$data = file($theURI.'?'.$theparams);

print_r($data);

?>


If that dies, try cutting the print_r call...
Image

User avatar
Mort
Alpha-Forum Whore
Alpha-Forum Whore
Posts: 4232
Joined: Thu Dec 01, 2005 10:40 pm

Re: Clan Leaderboard

Postby Mort » Mon Jan 03, 2011 10:42 pm

That worked. Is that supposed to trigger the stats site to also go update though? When I last checked it has a queue of 5000 with a 14hour wait time!

btw - I've set the script to just dump the output to a .csv file just in case you decide you want to do anything with it later, like put it in a database or something.
Image

User avatar
Piers
Comfortable with my sexuality
Comfortable with my sexuality
Posts: 1408
Joined: Fri Dec 02, 2005 7:57 am
Location: Horse country

Re: Clan Leaderboard

Postby Piers » Tue Jan 04, 2011 12:07 pm

Mort wrote:That worked. Is that supposed to trigger the stats site to also go update though? When I last checked it has a queue of 5000 with a 14hour wait time!


They've bumped up the queue because of the backlog of players wanting to update their stats. If a player is queued, the JSON data give you the queue number instead of "queue" : false at the end of the player's record. e.g. "queue": 4818

Current status:
PC
Update Time:
11h 08m 54s
6.8 per minute

It'll only queue them if the queue isn't full, the API page states (italics are mine):

Player updating

All players you try to pull will be automatically added to the update queue and get their update. This is limited to 3 hours since last update check.
Every player has a queue attribute containing the queue position or false if not in queue or limit conflicted.
The players_nodata array contains players of which we have no data in our database and gets updated soon.
The players_unknown array contains unknown players that get inserted into the search queue to find them.
Image


Return to “BF:Bad Company 2”

Who is online

Users browsing this forum: CommonCrawl [Bot] and 0 guests