Tuesday, October 20, 2009


I got kind of bored of my digital picture frame, like i normally do when a project is finished. So I wanted to do something else with it. One of the things I wanted to try to use was the command line interface instead of X. The idea was to get some nice scrolling text on the screen. An IRC-frame sounded like a nice idea until I realized I really want the system to be automatic and since IRC sometimes requires you to interact I decided to go with twitter instead.

I surfed around and found that PTT (Python Twitter Tools) seemed to be what I needed. To install PTT in Debian (I guess the same goes for all other debian derivatives like Ubuntu and so on) you first need to install the packages python-twitter and python-setuptools, and their respective dependencies.
To do this simply type the following in a console/terminal:
sudo aptitude install python-twitter python-setuptools

Then install installed PTT with:
sudo easy_install twitter

Now it's just a matter of either using the proper command line options to get PTT to do your bidding. To get an idea of what you can do simply type:
twitter -h

Since I like config-files I created one in my home dir called .twitter (this also happens to be the default config file PTT looks for. This is what my .twitter file contains:

email: myemailadress@someplace.com
password: mytwitterpassword
format: verbose
format: ansi

The email and password options are pretty self explanatory if you have a twitter account. Format however is the way twitter presents itself on your screen.
format: verbose | Prints out the full twitter post rather than just one line as per default.
format: ansi | Uses ansi coloring on the different usernames.

Since .twitter contains your password it can be a good idea to only allow your user to read it:
chmod 400 .twitter

Now that I had PTT working the way I wanted I simply added "twitter -r" to my .bash_profile to have it automatically launch after my system boots up. The "-r" causes PTT to continue running and updating the twitter feeds every five minutes.

No comments:

Post a Comment