Skip to content

Commit

Permalink
Added brief install instructions to README
Browse files Browse the repository at this point in the history
Changed fetch.py:
 added comments
 Now gets source and creates destination relative to current directory, to make it easier to install on different machines.
 Creates output directories if not there.
  • Loading branch information
MikeTheTechie committed Jun 16, 2011
1 parent 495584c commit 13e66a6
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
6 changes: 6 additions & 0 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ Issues
* H&C stations between Paddington and Hammersmith are missing or empty
in the source data from TfL.

Install
-------
To install:
* Clone the repo, e.g. git clone --recursive https://github.com/dracos/underground-live-map.git
* In terminal, cd to the bin folder. Then Run the script fetch.py to generate the data/london.js output file.

Possible TODOs
--------------
* Fix the remaining stations that are misplaced, consolidate all
Expand Down
17 changes: 16 additions & 1 deletion bin/fetch.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/usr/bin/python
""" Create the file /data/london.js from the sources files within the /data folder.
The client side code uses london.js for its static source data, e.g. geography of stations. """

from __future__ import division
import urllib
Expand All @@ -8,8 +10,21 @@
import os
import os.path
import mx.DateTime
import sys

dir = '/srv/traintimes.org.uk/public/htdocs/map/tube/bin/'
# get the current working directory, which is assumed to be the /bin directory within the project.
dir = os.getcwd() + '/'
print 'Data generation tool for underground-live-map\nUsage: python fetch.py\nMust be run from the bin folder within the project\n'
print 'Creating and populating directories: \n%s and \n%s' % ( dir + 'cache', dir + '../data' )
# Now create the destination directories relative to the cwd.
try:
os.mkdir('cache')
os.mkdir('../data')
except Exception as ex:
pass # ignore - probably exists already.

# If the above approach doesn't work for you, you could hard code dir liek this:
# dir = '/srv/traintimes.org.uk/public/htdocs/map/tube/bin/'

format = 'traintimes'

Expand Down

0 comments on commit 13e66a6

Please sign in to comment.