Showing posts with label Akregator. Show all posts
Showing posts with label Akregator. Show all posts

Thursday, March 08, 2007

Lost your Akregator feed list? Get it back from the archived data

While using my laptop via ssh (with X forwarding) to read my Akregator's feeds the Internet connection failed and Akregator was forced to close. Once back home I fired up Akregator to finish reading my feeds and to my surprise my feed list was gone!.

The feeds.opml file that contains the list was empty and the feeds.opml~ backup file had only the default entries.

After the shock and some failed recovery attempts I found that the archived feed data was intact (i.e. ~/.kde/share/apps/akregator/Archive) and a closer look at the contents of that directory revealed that the archive filenames are in fact the feed's URL addresses with some minor changes (i.e. "/"'s replaced with "_"'s).

With some bash magic I was able to recover the feed list using the following script:

#!/bin/sh

list=`ls http*mk4`

for i in $list; do

feed=`echo $i | sed -e 's/http___/http:\/\//' \
| sed -e 's/_/\//g' | sed -e 's/.mk4//'`
echo "Adding $feed"
`akregator -a $feed`
done

Copy the script inside the archives directory and make sure you are inside that directory before running it. Once running you will see how Akregator is fired up and the feed list starts filling automatically.

Make sure to make the script executable (i.e. chmod +x script.sh) or simply run it using the bash interpreter (i.e. bash script.sh).

On the down side I was unable to recover the group information and all the feed's were added to the Imported group inside Akregator.

As an additional note I must mention that in the archive directory there are two binary files that seem to contain all the feed list information (including groups). One of the files is called "feedlistbackup.mk4" and it's contents is almost identical to that of the feeds.opml file with some additional binary elements added to it. Maybe someone that knows the binary format can create a simple program to recover the feed list from that file including group information.