Using Akregator with Firefox 3.0

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:

  1. #!/bin/bash
  2. #
  3. # Add an RSS feed - either podcast or news.  podcasts get added to amarok, news to akregator,
  4.  
  5. main () {
  6.         for f in "$@"; do
  7.   f=${f:7}
  8.   f='http://'$f
  9.                 # GET the feed and try to guess what type it is.
  10.                 GET "$f" | grep -i enclosure |grep -q -i -e mp3 -e ogg
  11.                 if [ $? -eq 0 ]; then
  12.                         addPodcastFeed "$f"
  13.                 else
  14.                         addRegularFeed "$f"
  15.                 fi
  16.         done
  17. }
  18.  
  19. startKDEProgram () {
  20.         # note, doesn't need to use nohup and bg - kde progs do this already
  21.         # usage: startKDEProgram program timeout
  22.         dcop |grep -q "$1"
  23.         if [ $? -ne 0 ]; then
  24.                 am_running=0
  25.                 tries=0
  26.                 echo "$1 not running… starting it…"
  27.                 "$1"
  28.                 while [ $tries -lt $2 ] && [ $am_running -eq 0 ]; do
  29.                         echo "still waiting for $1 to start (giving up in $(($2 - $tries)) tries)…"
  30.                         sleep 1
  31.                         dcop |grep -q $1
  32.                         if [ $? -eq 0 ]; then
  33.                                 am_running=1
  34.                         fi
  35.                         let tries+=1
  36.                 done
  37.                 echo "tries made = $tries"
  38.                 if [ $tries -eq $2 ]; then
  39.                         kdialog –error "couldn't start $1"
  40.                         return
  41.                 fi
  42.         fi
  43. }
  44.  
  45. addRegularFeed () {
  46.         startKDEProgram akregator 30
  47.         dcop akregator AkregatorIface addFeedsToGroup '[' "$1" ']' Imported
  48.         kdialog –msgbox "news feed added to akregator"
  49. }
  50.  
  51. addPodcastFeed () {
  52.         startKDEProgram amarok 30
  53.         dcop amarok playlistbrowser addPodcast "$1"
  54.         kdialog –msgbox "podcast added to amarok"
  55. }
  56.  
  57. 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


Did you enjoy this post? Why not leave a comment below and continue the conversation, or subscribe to my feed and get articles like this delivered automatically each day to your feed reader. If you don't have a feed reader, you can always have these articles delivered to your email inbox every day. Click here to sign up.

Trackbacks & Pingbacks

No trackbacks/pingbacks yet.

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

Line and paragraph breaks automatic, e-mail address never displayed, HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>