Page 1 of 2

DDNet Statistics as a Download

Posted: Mon Jul 20, 2015 2:32 pm
by deen
If you want to do your own fun analysis with DDNet ranks and map releases, here's the raw data in CSV format, refreshed once a day: http://ddnet.org/stats/ddnet-stats.zip

Some more raw data is also available at http://ddnet.org/stats/

Re: DDNet Statistics as a Download

Posted: Sat Jul 25, 2015 1:03 am
by milk
Thanks! Here are import queries (with table structures) for MySQL. Maybe it will help someone:
SpoilerShow
Note that some maps don't have release date. You may want to replace string

Code: Select all

,\N
in file 'maps' with some default value like

Code: Select all

,"2000-01-01 00:00:00"
before import. Or these maps will have current timestamp as release date. (I tried to change default value in table structure but import query avoid it).

Code: Select all

# db

CREATE SCHEMA `ddnet` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ;


# maps

CREATE TABLE IF NOT EXISTS maps (
    Map VARCHAR(128) BINARY NOT NULL, 
    Server VARCHAR(32) BINARY NOT NULL, 
    Points INT DEFAULT 0, 
    Stars INT DEFAULT 0, 
    Mapper VARCHAR(128) BINARY NOT NULL, 
    Released TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
    KEY Map (Map)) 
CHARACTER SET utf8 ;

LOAD DATA INFILE '%path%/maps' 
INTO TABLE maps 
FIELDS TERMINATED BY ',' 
ENCLOSED BY '"'
LINES TERMINATED BY '\n' ;


# race

CREATE TABLE IF NOT EXISTS race (
    Map VARCHAR(128) BINARY NOT NULL, 
    Name VARCHAR(16) BINARY NOT NULL,
    Time FLOAT DEFAULT 0,
    Timestamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
    KEY Name (Name))
CHARACTER SET utf8 ;

LOAD DATA INFILE '%path%/race' 
INTO TABLE race 
FIELDS TERMINATED BY ',' 
ENCLOSED BY '"'
LINES TERMINATED BY '\n' ;


# teamrace

CREATE TABLE IF NOT EXISTS teamrace (
    Map VARCHAR(128) BINARY NOT NULL, 
    Name VARCHAR(16) BINARY NOT NULL,
    Time FLOAT DEFAULT 0,
    ID VARBINARY(16) NOT NULL,
    Timestamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
    KEY Name (Name))
CHARACTER SET utf8 ;

LOAD DATA INFILE '%path%/teamrace' 
INTO TABLE teamrace 
FIELDS TERMINATED BY ',' 
ENCLOSED BY '"'
LINES TERMINATED BY '\n' ;

Re: DDNet Statistics as a Download

Posted: Sat Jul 25, 2015 1:09 am
by deen
Hm, if you want to use it in MySQL, I guess I should just do an sql dump. Does this help?: http://ddnet.org/stats/ddnet-sql.zip

Re: DDNet Statistics as a Download

Posted: Sat Jul 25, 2015 1:15 am
by milk
Hah, yes now better. Thanks!

Re: DDNet Statistics as a Download

Posted: Sat Jul 25, 2015 1:44 am
by timakro
Is it save to split the mappernames by ", " and " & "? For example "=CuBe=, Kintaro* & =Typhoon=".

Re: DDNet Statistics as a Download

Posted: Sat Jul 25, 2015 1:50 am
by deen
DoNe wrote:Is it save to split the mappernames by ", " and " & "? For example "=CuBe=, Kintaro* & =Typhoon=".
save in what way? It's what I do to create this for example, so it should work.

Re: DDNet Statistics as a Download

Posted: Sat Jul 25, 2015 11:23 am
by timakro
Is there a way to get the time the file was changed last without downloading the entire http://ddnet.org/stats/ddnet-stats.zip?

Re: DDNet Statistics as a Download

Posted: Sat Jul 25, 2015 1:01 pm
by deen
DoNe wrote:Is there a way to get the time the file was changed last without downloading the entire http://ddnet.org/stats/ddnet-stats.zip?
It's updated daily at 5:30 am.

But in general you can check the timestamp with curl:

Code: Select all

$ curl -I -X HEAD http://ddnet.org/stats/ddnet-stats.zip
HTTP/1.1 200 OK
Server: nginx
Date: Sat, 25 Jul 2015 10:59:11 GMT
Content-Type: application/zip
Content-Length: 12458395
Last-Modified: Sat, 25 Jul 2015 03:30:29 GMT
Connection: keep-alive
Accept-Ranges: bytes

Re: DDNet Statistics as a Download

Posted: Wed Jul 29, 2015 2:07 pm
by timakro
Would it be possible to include the server (country) a finish happend on in the csv stats?

Re: DDNet Statistics as a Download

Posted: Wed Jul 29, 2015 2:12 pm
by deen
DoNe wrote:Would it be possible to include the server (country) a finish happend on in the csv stats?
Alright, should be in now.