Twitter + Growl = Trowel v1.0

You may have already read my how-to on integrating Twitter and Growl but this is the upgrade! I will go through the code for those interested, please help me improve the code by leaving a comment, good or bad.

I have some quite ambitious plans for this project, but this is not the time to bore you with promises, so vaporware it will remain – for now.

I’d like to start by thanking everyone who has commented on this project so far – it’s been such a big help, keep them coming.

 

What’s new?

If you can’t see a feature you requested its not because I am ignoring it, it’s simply I haven’t got round to it or it been superseded. As alway comments will always be read so you can always bug me there.

1. Profile images now supported

2. Run in the background and optionally use launchd

3. Sticky notifications for selected users

4. Loads more command line options

 

Bugs Fixed

UTF-8 encoding issue.

 

Download

Download here. Remember you’ll need some command line experience. See an example launchd plist file here.

 

Install

Installation is relatively simple, you will need to install some Perl modules, refer to the previous post for details.

 

Running

NB: I have split this command for ease of readability.

$ ./trowel -u <<EMAIL>> -p <<PASSOWRD>> -vv \
-I guykawasaki,twitter,stephenfry,rjstelling,macrumors,2009show \
-t twitter,stephenfry,rjstelling

 

-I tells the script what to notify you about

-t makes the notification sticky

 

Know Issues

There does seem to be an issues when running in launcd mode where Tweets are duplicated, any testing and info you can supply on this bug will help no end.

 

Documentation 

NAME
		trowel - display Twitter messages with Growl.

SYSOPSIS
		trowel -u -p [options]

EXAMPLES
		trowel -u <username> -p <password> -i 5 -l 180 -f "%t %d" \
		-t twitter,stephenfry,rjstelling \
		-I guykawasaki,twitter,stephenfry,rjstelling

OPTIONS
		-u, --username
			Twitter username

		-p, --password
			Twitter passord, if omitted it will be 
		 	requested interactively
		-i
			interval between displaying tweets

		-l, --poll
			time between polls of Twitter feed

		-x, --exclude
			list of users to exclude

		-t, --sticky
			list of users who's tweets are sticky, 
			-x and -i will override this

		-I, --include
			list of users to include

		-o
			output to STDOUT only, by-passing Growl,
			 use this for piping to another application

		-n
			initial number of Tweets to request, default is 5 

		-f "<format>"
			format of the Tweet
				%u - user
				%t - tweet
				%d - date time
				%l - location

		-g, --config
			a configuration file that sets command line 
			parameters, this function is not implemented

		-h, --help
			show this help 

		-v
			verbose mode

		-vv
			very verbose mode

		-vvv
			debug verbose mode

Tags: , , ,

9 Responses to “Twitter + Growl = Trowel v1.0”

  1. [...] THIS POST HAS BEEN SUPERSEDED BY Twitter + Growl = Trowel v1.0 [...]

  2. F2 says:

    Seeing encoded html entities (<) in stream…

  3. F2 says:

    A three-line patch solves the problem (the bug is really in Net::Twitter):

    spaceman:bin lucifred$ diff -u trowel ~/Desktop/trowel.txt
    — trowel 2009-06-11 06:48:18.000000000 -0400
    +++ /Users/lucifred/Desktop/trowel.txt 2009-06-11 06:56:20.000000000 -0400
    @@ -138,7 +138,6 @@
    use Net::Twitter;
    use Date::Format;
    use LWP::Simple qw(get);
    - use HTML::Entities;

    my $encode = eval { require Encode; };

    @@ -176,8 +175,6 @@
    {
    if(!$switch) { &SaveTweetID($t->{id}); $last_id = $t->{id}; $switch++; };

    - $t->{text} = decode_entities($t->{text}); #Fix Net::Twitter lack of HTML entity handling
    -
    if($parameters{include}{$t->{user}{screen_name}})
    {
    &Verbose(sprintf(”Included\t\t%s: %s”, $t->{user}{screen_name}, $t->{text}));

  4. F2 says:

    oops – took the patch backwards. Obvious sign I need to get some sleep :)

  5. Copprhead says:

    Excellent script! Thank you for sharing.
    Do you have an idea how the communication with Twitter could be done using https instead of http? I don’t like the idea of having my user/pass sent in plain text.

  6. Nice code, I’m using it all the time. My only request is that you get the links embedded in tweets to work.

  7. peterg says:

    Installed Trowel beta. Worked great.
    Just installed Trowel 1.0 over old Trowel. Trowel is now “invisible”. Can’t find Trowel > Preferences to install twitter acct info.
    Reverted back to beta. Works OK, but can’t still can’t find Trowel Preferences.
    What’s the “secret”?
    MacBook Pro, OS 10.6.2.
    Thanks

  8. peterg says:

    Please disregard my previous post. Found the answer. Thanks.

Leave a Reply