[sf-lug] BART train departure info from the command line
Sameer Verma
sverma at sfsu.edu
Sun Feb 8 20:17:46 PST 2009
On Sun, Feb 8, 2009 at 12:39 PM, John Magolske <b79net at gmail.com> wrote:
> At http://bart.gov/wireless/eta.aspx you can select a station from a
> pull-down list to check train departures. But I wanted a way to go
> straight to a given station by specifying it on the command-line. For
> example, `bart 16` or `bart sfo` to display real-time departures from
> the 16th/Mission or SF Airport stations respectively. I thought I'd
> pass it along here for any BART traveling command-line aficionados.
>
> The browser used (elinks) could be replaced with another. The other
> text-mode browser I'm familiar with is w3m, but it doesn't seem to do
> the auto-update of departure times. Something like Firefox would work,
> but I wanted everything to happen in one happy little tty.
>
> Kinda makes me want to jump on a train right now! Oh, wait...I do
> that Mon-Fri for work...hmmm, maybe better to just kick back & enjoy
> the rest of the weekend.
>
> John
>
>
> ----
>
>
> #!/bin/sh
> # A command line tool for checking BART trains departing a given station
> # Requires elinks as written here, but that can replaced with another
> # browser if you so desire...
> # (c)2008 John Magolske, GPL v3
> # Last edit: 2009/02/07 Sat 13:13 PST
>
> # If no station is specified go to the bart.gov/wireless pull-down list
> [ "$#" -eq 0 ] &&\
> elinks -no-connect 1 http://bart.gov/wireless/eta.aspx && exit 0
>
> # created easier to remember (for me) short-names for each station:
> ash="ASHB" # Ashby
> bal="BALB" # Balboa Park
> cas="CAST" # Castro Valley
> bay="BAYF" # Bay Fair
> civ="CIVC" # Civic Center
> col="COLS" # Coliseum/Oakland
> colma="COLM" # Colma
> con="CONC" # Concord
> daly="DALY" # Daly City
> berk="DBRK" # Downtown Berkeley
> dub="DUBL" # Dublin/Pleasanton
> cern="DELN" # El Cerrito del Norte
> cerp="PLZA" # El Cerrito Plaza
> emb="EMBR" # Embarcadero
> free="FRMT" # Fremont
> fruit="FTVL" # Fruitvale
> glen="GLEN" # Glen Park
> hey="HAYW" # Hayward
> laf="LAFY" # Lafayette
> lake="LAKE" # Lake Merritt
> mac="MCAR" # MacArthur
> mill="MLBR" # Millbrae
> mont="MONT" # Montgomery St.
> nberk="NBRK" # North Berkeley
> ncon="NCON" # North Concord/Martinez
> orin="ORIN" # Orinda
> pit="PITT" # Pittsburg/Bay Point
> phill="PHIL" # Pleasant Hill
> pow="POWL" # Powell St.
> rich="RICH" # Richmond
> rock="ROCK" # Rockridge
> sanb="SBRN" # San Bruno
> sfo="SFIA" # San Francisco Int\'l Airport
> slean="SANL" # San Leandro
> shay="SHAY" # South Hayward
> ssf="SSAN" # South San Francisco
> uni="UCTY" # Union City
> wcreek="WCRK" # Walnut Creek
> woak="WOAK" # West Oakland
>
> eval sta="\$$1"
>
> # variables can't begin with a number, for numbered stations do it like:
> [ "$1" = "16" ] && sta="16TH" # 16th St. Mission (SF)
> [ "$1" = "24" ] && sta="24TH" # 24th St. Mission (SF)
> [ "$1" = "12" ] && sta="12TH" # 12th St. Oakland City Center
> [ "$1" = "19" ] && sta="19TH" # 19th St. Oakland
>
> # call up bart.gov/wireless & go directly to the specified station
> elinks -no-connect 1 http://bart.gov/wireless/stationdetails.aspx?station="$sta"
>
> ## end of script ##
>
>
> --
> John Magolske
> http://B79.net/contact
>
> _______________________________________________
> sf-lug mailing list
> sf-lug at linuxmafia.com
> http://linuxmafia.com/mailman/listinfo/sf-lug
>
This is way cool!!!
Sameer
--
Dr. Sameer Verma, Ph.D.
Associate Professor of Information Systems
San Francisco State University
San Francisco CA 94132 USA
http://verma.sfsu.edu/
http://opensource.sfsu.edu/
More information about the sf-lug
mailing list