Welcome to Matthew Gates' personal nonsense site. It's a place to waffle on endlessly about computers and other nerd stuff without bothering anyone too much.
What is porpoisehead.net?Welcome to Matthew Gates' personal nonsense site. It's a place to waffle on endlessly about computers and other nerd stuff without bothering anyone too much. User login |
Firefox & Akergator on Kubuntu EdgyHere's how to configure firefox to work with the very nice KDE RSS feed aggregator, Akregator. These instructions were written for Kubuntu Edgy, but they'll probably work with other distros. The versions of the software used are:
Akregator has a command line option for adding a feed, but sadly, it doesn't work with the version which ships with Ubuntu Edgy. However, there is a work around which involves using the dcop interface to the program. You should create a file called /usr/local/bin/akadd, and put the following contents in it (you'll need to run your editor using sudo to be able to create a file here, or create it in your home directory, and move it using sudo): #!/bin/bash
akregator
for f in "$@"; do
dcop akregator AkregatorIface addFeedsToGroup '[' "$f" ']' Imported
done
You should also make the file executable, using this command: sudo chmod 755 /usr/local/bin/akadd Now you should open firefox, and go to the preferences dialog (edit menu -> preferences). From here, select the "Feeds" section, select the radio button "Subscribe to the feed using:", and click the "Choose Application" button. Navigate to the /usr/local/bin directory and select akadd. That should be it. Close the preferences window, go to a page with an RSS feed and click the feed (the RSS icon in the location bar, or some feed link on the page) to subscribe. Voila! Update - now handles podcasts!I re-wrote the akadd script to distinguish between news RSS feeds and podcast feeds. Firefox will call th akadd script for both, and it was quite annoying to end up with podcast feeds in akregator. Podcast feeds are added to amarok. The new version of the script also has a rather more robust way to start the app in question if it's not already running. In the case of akregator and amarok, they have to be started first because the dcop interface is the method to add feeds, and this only works once the program in question is running. One more thing. You have to have the GET program. This is usually a symlink to lwp-request, a program which comes with the libwww-perl package (at least that's the package in Ubuntu Egdy. I'm not sure about other distros). Anyhow, here it is: #!/bin/bash
#
# Add an RSS feed - either podcast or news. podcasts get added to amarok, news to akregator,
main () {
for f in "$@"; do
# 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 "$@"
|