Skip to content

An intuitive bus time application providing bus stop locations, timetables and live bus times in Brighton, UK.

License

Notifications You must be signed in to change notification settings

aliceh75/brightbus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Brightbus

An intuitive bus time application providing bus stop locations, timetables and live bus times in Brighton, UK.

Licensed under the GPL V3

Platforms

Deployment

These are build & deployment instructions for Debian based Linux distributions. You may need to adapt those depending on your environment. There are a number of dependencies: The Android SDK, Cordova, bower, npm ... Many of these tools have their own quirks, and the instructions I provide here may not work out of the box. I would advice to only try this if you are willing to spend some time making it work!

Install the Android SDK

To deploy on Android, you will need to instal the Android SDK. These instructions have worked for me, but you'll probably have a bit of work to do to get it right:

cd /usr/local
sudo wget http://dl.google.com/android/android-sdk_r24.3.4-linux.tgz
sudo tar -xzf android-sdk_r24.3.4-linux.tgz
sudo chmod -R ugo+rwX android-sdk-linux
cd android-sdk-linux
sudo chmod ugo+x tools/android
sudo ./tools/android update sdk --no-ui

This done, you must make sure the android SDK is in your path. Edit ~/.bashrc and set:

PATH="$PATH:/usr/local/android-sdk-linux/tools:/usr/local/android-sdk-linux/platform-tools"

Install Cordova and Bower

To support Android 2.3, you must use Cordova 4.3.0. This may work with Cordova 5, but has not yet been tested. To manage it's javascript dependencies, the application uses bower. To install Cordova and bower, you must first install npm... Yes, that's quite a chain of dependencies!

sudo apt-get install npm
sudo npm -g install cordova@4.3.0
sudo npm -g install bower

Install cordova dependencies

There's a script to do just that:

./setup.sh

Install Javascript dependencies

cd www
bower install

Build the stops database

This is done using the Python scripts in databuilder. If you are not familiar with Python, I would advise to install Python, pip and virtualenv:

sudo apt-get install python python-pip python-virtualenv

Now you can initialize the databuilder script and install it's dependencies without polluting your global Python environement:

cd databuilder
virtualenv .ve
source .ve/bin/activate
pip install -r requirements.txt
deactivate

Building the data takes several steps. Before running any of those steps, you need to activate the virtual environmnet:

cd databuilder
source .ve/bin/activate

First you need to download the data. The Naptan dataset is directly available, however to get the Traveline National Dataset you will need to get an FTP username and password from Traveline by applying at http://www.travelinedata.org.uk/traveline-open-data/traveline-national-dataset/.

Once you have the username and password, you can download and extract all the required data by running:

./download_data_files.py -a <tnds ftp username> -p <tnds ftp password>

You can then build an intermediary file that is used to index which bus line stops at which stops (this is why we need the TNDS data - everything else comes from the Naptan database):

./build_stop_line_info.py

And finally you can build the database that is used by BrightBus:

./databuilder.py

Running the script will create the stops file in www/data/stops.json. You only need to rebuild it if the source data (but stops and lines information) has changed - or possibly when upgrading Brightbus, check the release notes for each release.

To exit the virtual environment, you can run:

deactivate

Run on android!

Plug your android device in and...

cordova run android

If this fails to see your Android device, you might need to restart adb as root:

sudo /usr/local/android-sdk-linux/platform-tools/adb kill-server
sudo /usr/local/android-sdk-linux/platform-tools/adb start-server

And try again. Good luck!

Testing

Tests are implented using Karma. To run the tests run:

cd www/tests
karma start

About

An intuitive bus time application providing bus stop locations, timetables and live bus times in Brighton, UK.

Resources

License

Stars

Watchers

Forks

Packages

No packages published