Get updated road conditions in conky

January 5th, 2010 | by Pyro222 |

For many, road conditions can be as crucial as anything else the day might throw your way, especially for those that live in inclement areas. You have undoubtedly seen many scripts for getting the weather in your conky setup so to compliment your already fabulous .conkyrc file, here is an easy way to grab the current road conditions for your city, and display them into conky as well.
Read on for step by step instructions.

The Rundown

This one is simple. Create and schedule a php script that will parse a feed and save the data to a file that conky will use to post the road condition data.
EDIT: Turns out conky has a really cool rss variable. We only need tell conky where the feed is located.

The Feed URL

First things first we must setup our feed url. Thanks to John Resig (ejohn.org) who has broken down the yahoo live traffic feed, we can create our custom feed link with little to no effort.

The feed link will look something like this

http://maps.yahoo.com/traffic.rss?csz=95821&mag=5&minsev=1

The three values of concern in the url are as follows.

  • csz – Location. Can be zip, city, or address.
  • mag – Manification. (ie. 3 = 4miles; 5 = 40 miles)
  • minsev – Minimum severity of the road condition. 1=lowest/minor, 5=highest/critical

You may also visit John’s blog post to generate a url automatically.
Confirm the url by visiting it with your browser and once you like it, copy the url in a text file somewhere.

.conkyrc

  1. edit your ~/.conkyrc file as follows
    1
    2
    
    ${color orange}ROAD CONDITIONS${hr 2}$color
    ${color white}${rss http://maps.yahoo.com/traffic.rss?csz=95670&mag=5&minsev=3 10 item_titles 10}

That should do it. When all is said and done, you should have a nice little “Road Conditions” section at the bottom of conky with an easy to read list of current road conditions.

Thanks for stopping by.

Sources

Traffic Conditions Data by John Resig (ejohn.org)
Parse RSS With PHP (www.softarea51.com)
Yahoo Maps Traffic Feed (maps.yahoo.com/traffic.rss)

Similar Entries

Sorry, comments for this entry are closed at this time.