Code Monkey home page Code Monkey logo

bart's Introduction

bart

Purpose

Access real-time BART train departures using python and the Real Bart API. I always have a terminal window open, so I wrote this little command-line tool just so I don't have to open up a browser window to check the BART schedule.


Setup

Your very own BART API key is required and can be requested from api.bart.gov. Once obtained, name an environment variable named BART_API_KEY in your appropriate login script:

$ echo export BART_API_KEY=YOUR_KEY >> ~/.bash_profile

To use bart as I do in the terminal, alias bart.py by adding alias bart="~/bart/./bart.py" to your appropriate shell profile, or append by the following command:

$ echo alias bart="~/bart/./bart.py" >> ~/.bash_profile

To display the ETAs for north-bound trains at the 16th Street Mission station.

$ bart 16th n
Bart Service Status
	No delays reported.

16th St. Mission at 10:57:34 AM 
 Dublin/Pleasanton train in  6 minutes,
 Dublin/Pleasanton train in 20 minutes,
 Dublin/Pleasanton train in 35 minutes,
           Fremont train in 12 minutes,
           Fremont train in 27 minutes,
           Fremont train in 42 minutes,
Pittsburg/BayPoint train in  9 minutes,
Pittsburg/BayPoint train in 23 minutes,
Pittsburg/BayPoint train in 38 minutes,
          Richmond train in 15 minutes,
          Richmond train in 30 minutes,
          Richmond train in 46 minutes,

To automatically display the ETAs every minute, include the tracking flag.

$ bart civc s -t

Pipe it!

Perfrom a numeric sort on the ETA field.

$ bart 16th n | tail +2 | sort -n -k4,4

Only show Richmond trains.

$ bart 19th n | grep Richmond

Say it.

$ bart plza s | say

bart's People

Contributors

abshinn avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.