View Single Post
Posts: 540 | Thanked: 387 times | Joined on May 2009
#6
...For those of us that prefer CLI:

add to ~/.profile

Code:
flight_status() { if [[ $# -eq 3 ]];then offset=$3; else offset=0; fi; curl "http://mobile.flightview.com/TrackByRoute.aspx?view=detail&al="$1"&fn="$2"&dpdat=$(cu-date +%Y%m%d -d ${offset}day)" 2>/dev/null |html2text |grep ":"; }


 
then simply run

Code:
$ flight_status LH 471

Status: In Air
Departure: Toronto, ON (YYZ)
Scheduled: 6:15 PM, Feb 20
Takeoff:   6:41 PM, Feb 20
Term-Gate: Terminal T1 - 172
Arrival:   Frankfurt, Germany (FRA)
Scheduled: 8:05 AM, Feb 21
Estimated: 8:23 AM, Feb 21
Remaining: 3 hr 41 min
Term-Gate: Terminal 1
^ for today

Code:
$ flight_status LH 471 +1

Status: Scheduled
Departure: Toronto, ON (YYZ)
Scheduled: 6:15 PM, Feb 21
Term-Gate: Terminal T1 - 173
Arrival:   Frankfurt, Germany (FRA)
Scheduled: 8:05 AM, Feb 22
Term-Gate: Terminal 1
^ for tomorrow

Code:
$ flight_status LH 471 -1

Status: Arrived
Departure: Toronto, ON (YYZ)
Scheduled: 6:15 PM, Feb 19
Takeoff:   6:31 PM, Feb 19
Term-Gate: Terminal T1 - 172
Arrival:   Frankfurt, Germany (FRA)
Scheduled: 8:05 AM, Feb 20
At Gate:   8:30 AM, Feb 20
Term-Gate: Terminal 1
^ for yesterday

Requirements:
* html2text (it's in the SDK repo if not the regular repo)
* curl ( http://www.box.net/os2008#os2008/1/38267044/393488254/1 )
* date (CoreUtils version, not busybox; http://www.box.net/os2008#os2008/1/38267044/393493066/1 )
rename cu-date.rename to cu-date and place in /usr/bin and give it executable permission

i.e.:
Code:
# mv cu-date.rename  /usr/bin/cu-date
# chmod +x /usr/bin/cu-date
P.S.
runs great on linux desktop too
Code:
flight_status() { if [[ $# -eq 3 ]];then offset=$3; else offset=0; fi; curl "http://mobile.flightview.com/TrackByRoute.aspx?view=detail&al="$1"&fn="$2"&dpdat=$(date +%Y%m%d -d ${offset}day)" 2>/dev/null |html2text |grep ":"; }


 
Also if you are using busybox date or enter an invalid date, you still get some useful info

Code:
$ flight_status LH 471 +x

date: invalid date `+xday'
Departing: ???, ??
Arriving: ???, ??
Time: -
Date: Mon, January 1
Actual Takeoff: 6:31*PM, Feb*19
At Gate:        8:30*AM, Feb*20
Actual Takeoff:    6:41*PM, Feb*20
Estimated Arrival: 8:19*AM, Feb*21
Scheduled Departure: 6:15*PM, Feb*21
Scheduled Arrival:   8:05*AM, Feb*22
Scheduled Departure: 6:15*PM, Feb*23
Scheduled Arrival:   8:05*AM, Feb*24
--More--
 

The Following 6 Users Say Thank You to linuxeventually For This Useful Post: