Wolfdog.org forum

Wolfdog.org forum (http://www.wolfdog.org/forum/index.php)
-   Setkání a cestování (http://www.wolfdog.org/forum/forumdisplay.php?f=112)
-   -   CSV stat site sources (http://www.wolfdog.org/forum/showthread.php?t=22311)

elf 01-07-2012 18:33

CSV stat site sources
 
Please find as requested the source code of the csv stat site:
http://code.google.com/p/wolfdog-sta...source/browse/

It would be easy then for a developer to maintain it and keep it up to date.

Fiann 03-07-2012 15:12

Hi, is there any documentation for the sources? At least formating for a database file (the WDDB is the database file for wolfdog I guess from the brief look I took at the files)? I took a look into the file and it isn't clear to me at all how the individual records are formed, separated, etc.
Or is there any other option how to add a new dog into the database other then just add him to the file?



www.ceskoslovenskyvlcak.websnadno.cz

elf 03-07-2012 19:25

The DB is just plain Python dictionnary dump in a file (WDDB_utf8 ) through pickle, you can convert it to SQLite or MySQL if needed, if you want to see the structure of the DB you can do a DB print with:

import cPickle as pck

f = file("WDDB_utf8", 'rb')
db = pck.load(f)
f.close()

for key in db:
print db[key]

You would see all the entries like e.g.:

{'COIFA': '24.1711914539%', 'BIRTHDAY': '1999.12.27', 'LIVING COUNTRY': 'Slovakia', 'INDEX_FORMAT': 'data not available', 'HIP': 'A(0/0)', 'TRAINING': 'VZ 40km', 'BONITATION':
'A69 C2 K1 Of R1 P1', 'PRA': 'data not available', 'GENDER': 'Male', 'PIC': 'Arek_Maly_Bystrec.jpg', 'FATHER': 'd1184.html', 'COI5G': '18.9611494541%', 'INDEX_HEIGHT': 'data not a
vailable', 'MOTHER': 'd1185.html', 'AVK5G': '54.8387096774%', 'OFFSPRING': ['d6430.html', 'd5187.html', 'd7404.html', 'd5291.html', 'd5189.html', 'd5710.html', 'd5579.html', 'd5184
.html', 'd14438.html', 'd5185.html', 'd8180.html', 'd5186.html', 'd6418.html', 'd7405.html', 'd5709.html', 'd8359.html', 'd8367.html', 'd6426.html', 'd5188.html', 'd5290.html', 'd8
368.html', 'd8323.html', 'd6429.html', 'd5575.html', 'd5288.html', 'd5287.html', 'd5289.html', 'd7410.html', 'd8358.html', 'd6427.html', 'd5292.html', 'd5580.html', 'd5293.html', '
d5576.html', 'd7409.html', 'd5577.html', 'd5286.html', 'd6424.html', 'd7412.html', 'd8360.html', 'd6428.html', 'd5574.html', 'd7407.html', 'd6431.html', 'd5711.html', 'd5578.html',
'd6425.html', 'd7408.html'], 'COAT_LENGHT': 'data not available', 'ED': 'data not available', 'COAT_COLOR': 'data not available', 'ORIGIN COUNTRY': 'Slovakia', 'BREEDER': 'Medveck
\xc3\xbd, Lubo\xc5\xa1 (Mal\xc3\xbd Bysterec )', 'NAME': 'Arek Mal\xc3\xbd Bysterec', 'AVK8G': '30.9803921569%', 'OWNER': 'Lupt\xc3\xa1k, Pavol (od Starkej )', 'LIVING CITY': '\n97
6 44 M\xc3\xbdto pod ?umbierom'}

Then you get each field accessing by key: NAME, HIP, ED, BIRTHDAY etc... Note usage of UTF-8 encoded string.

Quote:

Or is there any other option how to add a new dog into the database other then just add him to the file?
With the source you can easily clone the csv stat site on a server with Python installed (just change in the files SERVER = "http://www.amicale-chien-loup-tchecoslovaque.com/cgi-bin" by you server hostname (yeah lame I know, I never refactor the code...)), and then add a facade to add dogs etc.


All times are GMT +2. The time now is 18:33.

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
(c) Wolfdog.org