Skip to content

Commit

Permalink
Tramwaje: aktualizacja bazy
Browse files Browse the repository at this point in the history
  • Loading branch information
macbre committed Jan 1, 2014
1 parent b4499ab commit 8aa89d2
Show file tree
Hide file tree
Showing 2 changed files with 163 additions and 3 deletions.
158 changes: 157 additions & 1 deletion db/tramwaj.json
@@ -1 +1,157 @@
[{"name":"0","from":1988,"to":1992},{"name":"1","from":1898,"to":2012},{"name":"2","from":1880,"to":2012},{"name":"3","from":1911,"to":2012},{"name":"4","from":1898,"to":2012},{"name":"5","from":1906,"to":2012},{"name":"6","from":1880,"to":2012},{"name":"7","from":1911,"to":2012},{"name":"8","from":1911,"to":2012},{"name":"9","from":1913,"to":2012},{"name":"10","from":1929,"to":2012},{"name":"13","from":1943,"to":2012},{"name":"16","from":2002,"to":2012},{"name":"17","from":1957,"to":2012},{"name":"18","from":1957,"to":2012},{"name":"19","from":1961,"to":1992},{"name":"20","from":1970,"to":1993},{"name":"21","from":1974,"to":1989},{"name":"22","from":1978,"to":1992},{"name":"23","from":1979,"to":1992},{"name":"24","from":1980,"to":1991},{"name":"25","from":2011,"to":2012},{"name":"26","from":2007,"to":2012},{"name":"27","from":2011,"to":2012},{"name":"30","from":2012,"to":2012},{"name":"31","from":2012,"to":2012},{"name":"32","from":2012,"to":2012},{"name":"N21","from":1997,"to":2012},{"name":"D","from":1998,"to":2002}]
[
{
"name": "0",
"from": 1988,
"to": 1992
},
{
"name": "0",
"from": 1999,
"to": 2012
},
{
"name": "1",
"from": 1898,
"to": 2012
},
{
"name": "2",
"from": 1880,
"to": 2012
},
{
"name": "3",
"from": 1911,
"to": 2012
},
{
"name": "4",
"from": 1898,
"to": 2012
},
{
"name": "5",
"from": 1906,
"to": 2012
},
{
"name": "6",
"from": 1880,
"to": 2012
},
{
"name": "7",
"from": 1911,
"to": 2012
},
{
"name": "8",
"from": 1911,
"to": 2012
},
{
"name": "9",
"from": 1913,
"to": 2012
},
{
"name": "10",
"from": 1929,
"to": 2012
},
{
"name": "11",
"from": 1935,
"to": 2012
},
{
"name": "13",
"from": 1943,
"to": 2012
},
{
"name": "16",
"from": 1953,
"to": 2012
},
{
"name": "17",
"from": 1957,
"to": 2012
},
{
"name": "18",
"from": 1957,
"to": 2012
},
{
"name": "19",
"from": 1961,
"to": 2012
},
{
"name": "20",
"from": 1970,
"to": 1993
},
{
"name": "21",
"from": 1974,
"to": 1989
},
{
"name": "22",
"from": 1978,
"to": 1992
},
{
"name": "23",
"from": 1979,
"to": 1992
},
{
"name": "24",
"from": 1980,
"to": 1991
},
{
"name": "25",
"from": 2011,
"to": 2012
},
{
"name": "26",
"from": 2007,
"to": 2012
},
{
"name": "27",
"from": 2011,
"to": 2012
},
{
"name": "30",
"from": 2012,
"to": 2012
},
{
"name": "31",
"from": 2012,
"to": 2012
},
{
"name": "32",
"from": 2012,
"to": 2012
},
{
"name": "N21",
"from": 1997,
"to": 2012
},
{
"name": "D",
"from": 1998,
"to": 2002
}
]
8 changes: 6 additions & 2 deletions tramwaj.js
@@ -1,11 +1,15 @@
var fs = require('fs'),
bot = require('../lib/bot').bot,
bot = require('nodemw'),
client = new bot('config.js');

var lines = [];

client.getPagesInCategory('Linie tramwajowe', function(pages) {
pages.forEach(function(page) {
if (page.ns !== 0) {
return;
}

client.getArticle(page.title, function(content) {
client.expandTemplates(content, page.title, function(tmpl) {
var from = client.getTemplateParamFromXml(tmpl, 'uruchomiona') || '',
Expand Down Expand Up @@ -36,7 +40,7 @@ client.getPagesInCategory('Linie tramwajowe', function(pages) {
}
});

fs.writeFileSync('db/tramwaj.json', JSON.stringify(lines));
fs.writeFileSync('db/tramwaj.json', JSON.stringify(lines, null, ' '));
}
});
});
Expand Down

0 comments on commit 8aa89d2

Please sign in to comment.