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:
#!/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