Archive

Archive for May, 2008

Using Akregator with Firefox 3.0

May 29th, 2008

If you’re a linux user like I am, there’s a good chance that you’re using Firefox as your web browser and Akgregator as your news reader.  Since Firefox has no native support for Akregator, you have to set up a little script of your own to get everything working together.

First, run a text editor as root.  In Gnome, type the following in a terminal:

gksudo gedit

In Kde, type the following:

sudo kate

Paste the following code into the editor of your choice:

Download the akadd.sh shell script and save it to your hard disk.

Download: akadd.sh

Open the code in your text editor as root.

The code listing for the script is as follows:

#!/bin/bash
#
# Add an RSS feed - either podcast or news.  podcasts get added to amarok, news to akregator,

main () {
        for f in "$@"; do
		f=${f:7}
		f='http://'$f
                # GET the feed and try to guess what type it is.
                GET "$f" | grep -i enclosure |grep -q -i -e mp3 -e ogg
                if [ $? -eq 0 ]; then
                        addPodcastFeed "$f"
                else
                        addRegularFeed "$f"
                fi
        done
}

startKDEProgram () {
        # note, doesn't need to use nohup and bg - kde progs do this already
        # usage: startKDEProgram program timeout
        dcop |grep -q "$1"
        if [ $? -ne 0 ]; then
                am_running=0
                tries=0
                echo "$1 not running... starting it..."
                "$1"
                while [ $tries -lt $2 ] && [ $am_running -eq 0 ]; do
                        echo "still waiting for $1 to start (giving up in $(($2 - $tries)) tries)..."
                        sleep 1
                        dcop |grep -q $1
                        if [ $? -eq 0 ]; then
                                am_running=1
                        fi
                        let tries+=1
                done
                echo "tries made = $tries"
                if [ $tries -eq $2 ]; then
                        kdialog --error "couldn't start $1"
                        return
                fi
        fi
}

addRegularFeed () {
        startKDEProgram akregator 30
        dcop akregator AkregatorIface addFeedsToGroup '[' "$1" ']' Imported
        kdialog --msgbox "news feed added to akregator"
}

addPodcastFeed () {
        startKDEProgram amarok 30
        dcop amarok playlistbrowser addPodcast "$1"
        kdialog --msgbox "podcast added to amarok"
}

main "$@"

save this little script in /usr/bin/feeds, with the filename akadd, then close your editor and go back to the command prompt.  CD to /usr/bin/feeds and type:

sudo chmod 755 akadd

Now you have to tell firefox where to find this little gem.  To do this, just click on the RSS icon in the address bar and select /usr/bin/feeds/akadd.  You should be up and running!

NOTE:

The original akadd script was written by Mathew Gates, and can be found here.

The fix to make it useful with Firefox 3.0 Beta was written by a French student at Linux tips, and can be seen here.

The reason my version is longer is because i really did want podcasts to go straight to Amarock, and I like the dialogs ;)   Both versions work, I simply modified the longer version

Jerry General Geekiness ,

On Personal Matters

May 3rd, 2008

This week’s scheduled post has been rudely and unceremoniously interrupted by this thing I like to call my life.  In the past seven days we have been told that we need to move within the next two weeks!, That I could not find a suitable home for my beloved family pet, who had to be taken to a shelter (more about that here.), and that a friend’s wife had to be sent to the Intensive care unity at the local hospital.

Needless to say my attention has been focused elsewhere, and the article planned for this week remains half written.  I’ll be getting back to it on Monday.  for now, there are far more pressing matters to attend to…  Like helping our friend feed his four kids and visiting in-laws!

Jerry General

ss_blog_claim=3928b73221a2ea923abbd6c5cb76831e ss_blog_claim=3928b73221a2ea923abbd6c5cb76831e