Using Akregator with Firefox 3.0

More on this subject

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

Popularity: 3% [?]

4 Comments

It didn’t work for me. I tried running it from the command line and got

/usr/bin/feeds/akadd: line 29: syntax error near unexpected token `(‘
/usr/bin/feeds/akadd: line 29: `echo “still waiting for $1 to start (giving up in $(($2 – $tries)) tries)…”’

Any ideas ?

Cheers,
Paul

Paul,
I would have to see the original source to know why it’s tossing an error at line 29. I directly copied the code from the above post and it’s working properly for me on Ubuntu Hardy. Are you perhaps running a different flavor of Linux?

When I cut & paste, I get a file with weird chars, e.g. instead of normal double-quotes on the last line, I get the main [left-leaning double quote] [dollar] [at] [right-leaning double-quote]. I’ve tried cutting from Firefox 3, Konqueror and Akregator, and pasting into vi, kate and gedit, without being able to get “normal” double quotes. Some of the other chars are a bit weird also.

Which browser / editor combination did you use ? Is there some way you can wrap the text in tags to prevent introduction of these chars ? I really want to use the script !

Cheers,
Paul

Paul,

I uploaded my working copy of the akadd script. You’ll find the link just above the code listing. See if this helps!

Meanwhile I’ll do a look around for a good code formatting and highlighting plugin.

Leave a Comment

 
CommentLuv Enabled