Subscribing to RSS Feeds in Firefox 2.0 for Akregator
Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
I'm using Firefox 2.0.0.11 on Slackware 12 in KDE 3.5.7 with akregator 1.2.7. Firefox has a feature where you can preview a RSS feed and then select an application to subscribe to it without having to manually open the app and subscribe to it. I would like to do this with akregator but it does not work.
I even wrote a couple of scripts (that use akregator) for Firefox to point to, but this did not help either. The two scripts basically are...
Code:
#!/bin/bash
/usr/bin/akregator
for f in "$@"; do
dcop akregator AkregatorIface addFeedsToGroup '[' "$f" ']' Imported
done
and ...
Code:
#!/bin/sh
if [ $1 ]
then
/usr/bin/akregator -a $1
fi
They both execute properly from the command line; the feeds I test get imported. However, nothing happens from Firefox. There are no messages from Firefox on the command line either.
Has anybody gotten this working (particularly for a setup similar to mine)?
#!/bin/bash
/usr/bin/akregator
for f in "$@"; do
dcop akregator AkregatorIface addFeedsToGroup '[' "$f" ']' Imported
done
in the file /usr/local/bin/akadd and it works too.
Did you click directly on the script file to see if it works (I guess you already did)? I it worked (opened Akregator, but added nothing since there was no object to add) than the problem might be on Firefox side. It happens that I choose some option in Firefox and it never works. Wich I usually don't bother...
Before I found the tip in the page I referred to in previous post, I also tried to aim directly at Akregator (usr/bin) with Firefox, wich had no effect at all on Firefox.
The problem could also come from the location of your script file in your system. Or file's rights but I guess you know better than me about that.
The problem is that Firefox doesn't seem to execute the scripts. It has nothing to do with permissions, because like I said, they execute just fine from the command line. If anything, it would be an environment issue.
It should execute any code I point Firefox to, but it doesn't. Even if I have it run something that doesn't need a gui (like echoing text into a file) it doesn't work. The script is simply not being executed.
I ran the tests on Ubuntu and they ran fine. I could point the feed handler to gedit, for instance, and I would see the xml page pop up. Using the second script in my first post did exactly what I needed in Ubuntu (and yes, I even tested it with akregator).
I tried this back in Slackware under different firefox profiles and even tried it on Firefox 3.0. This all produced the same results as before.
I don't understand why this doesn't work in Slackware, but it works in Ubuntu. I probably should download the vanilla firefox and test it with a fresh (firefox) profile to see if it still works because Ubuntu might have modified some things in their binaries/default firefox profiles.
At any rate, I have found a solution for Slackware, which I will detail in my next post. However, I am still interested in figuring out why the before mentioned methods do not work.
Basically, here's what I did to make Firefox's RSS integration with Akregator work. Copy these directions and close Firefox before the first step.
1) Hack FeedConverter.js (as root)
Code:
cd /usr/lib/firefox/components/
cp FeedConverter.js FeedConverter.js.BAK
pico -w FeedConverter.js
Edit the file by replacing
Code:
case "client":
var clientApp =
prefs.getComplexValue(PREF_SELECTED_APP, Ci.nsILocalFile);
//@line 393 "/builds/tinderbox/Fx-Mozilla1.8-release/Linux_2.4.21-27.0.4.EL_Depend/mozilla/browser/components/feeds/src/FeedConverter.js"
var ss =
Cc["@mozilla.org/browser/shell-service;1"].
getService(Ci.nsIShellService_MOZILLA_1_8_BRANCH);
ss.openApplicationWithURI(clientApp, spec);
break;
with
Code:
case "client":
const PREF_SELECTED_APP_ARGS = "browser.feeds.handlers.application.args";
const PREF_SELECTED_APP_URIPREFIX = "browser.feeds.handlers.application.uriPrefix";
var clientApp = prefs.getComplexValue(PREF_SELECTED_APP, Ci.nsILocalFile);
var feedhandlerArgs = safeGetCharPref(PREF_SELECTED_APP_ARGS).split(" "); //get all args words delimitted by space into array
var uriPrefix = safeGetCharPref(PREF_SELECTED_APP_URIPREFIX);
var file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsILocalFile);
file.initWithPath(clientApp.persistentDescriptor);
var process = Cc["@mozilla.org/process/util;1"].createInstance(Ci.nsIProcess);
process.init(file);
if (uriPrefix) spec = uriPrefix + spec;
if (feedhandlerArgs) {
var args = feedhandlerArgs;
args[args.length] = spec; // add uri as last arg at the end
}
else
var args = [spec];
process.run(false, args, args.length);
// debug("FeedConverter.js: ", (clientApp.persistentDescriptor + " " + args));
break;
2) Set Firefox Config Settings
Open Firefox as your main non-root user and go to about:config. Type feed under the Filter input box.
Change browser.feeds.handlers.application value to /usr/bin/akregator.
Right click and add the new strings for: browser.feeds.handlers.application.args with Value --addfeed browser.feeds.handlers.application.uriPrefix with Value feed:
Now test it on a feed as it should now work! Notice that a script was not even necessary. If anyone would prefer to use a patch instead of manually editing their FeedConverter.js, I can make one and post it.
Last edited by shadowsnipes; 02-09-2008 at 03:28 PM..
Reason: code formatting
as shown before doesn't run anything (at least on my Slackware box).
I can set browser.feeds.handlers.application to anything including something /like /usr/bin/mousepad and it will run correctly now. The other new config options, of course, are a bonus.
Is anybody familiar with the openApplicationWithURI method and would perhaps know why it wasn't correctly working for me?
I'm on Kubuntu 7.10 and I don't know if that matter.
I've tried the solution Shadowsnipes provided; it wouldn't work here.
The only thing that happened when i clicked the rss feed icon was that akregator showed up (became active) but it wouldn't add the feed.
I also tried the solution from: "porpoisehead" and that didn't work either.
I then combined the two solutions and got it to work.
To be more precise:
I used the akadd file from "porpoisehead" and i've modified the "FeedConverter.js" and changed FF settings according to Shadowsnipes solution with one difference:
Instead of changing:
"browser.feeds.handlers.application value to /usr/bin/akregator"
I changed it to: /usr/local/bin/akadd
The issue I have now is that every time I add a feed i get this empty feed as well. So for every feed i want to add i get two feeds.
One feed works just as it should and the empty one only contains the FF argument from Shadowsnipes solution.
For instance, the name of the feed is blank and the web adress is: http://--addfeed
Are there any ways to get rid of the "empty" feed when adding rss feeds?
Would love to get this working properly please.
I ask this because the FeedConverter patch made it so processes would be executed properly, but it sounds like the --addfeed part wasn't working. Maybe you should try -a instead of --addfeed for the respective Firefox setting. This is only if you are using akregator directly, though, and not a script.
The command line suggestion makes the akgregator window active but that's it, it doesn't add the feed.
When trying "-a" instead of "--addfeed" in firefox it works indentical to the "--addfeed" solution. E.g. i get two feeds where one of them is blank.
When i try with the empty string for: *browser.feeds.handlers.application.args*
the behaviour of FF changes. For instance; I've tried adding rss feeds on sites where there's multiple feeds "baked in". I click on rss in the address field and it then shows which feed i want to subscribe to.
I then click on it and it's added.
HOWEVER, when the string is empty the behaviour changes.
When i click the rss icon a new page is loaded with a dropdown window (from where i choose which program i want to open the feed with) and a button named "subscribe now".
I've tried this and nothing happens when i click the button. I'v tried with both "akregator" and "akadd" as default programs for feed opening.
I've also tried changing the:
*browser.feeds.handlers.application*
to:
/usr/local/bin/akadd
instead of:
/usr/bin/akregator
The command line suggestion makes the akgregator window active but that's it, it doesn't add the feed.
When trying "-a" instead of "--addfeed" in firefox it works indentical to the "--addfeed" solution. E.g. i get two feeds where one of them is blank.
When i try with the empty string for: *browser.feeds.handlers.application.args*
the behaviour of FF changes. For instance; I've tried adding rss feeds on sites where there's multiple feeds "baked in". I click on rss in the address field and it then shows which feed i want to subscribe to.
I then click on it and it's added.
HOWEVER, when the string is empty the behaviour changes.
When i click the rss icon a new page is loaded with a dropdown window (from where i choose which program i want to open the feed with) and a button named "subscribe now".
I've tried this and nothing happens when i click the button. I'v tried with both "akregator" and "akadd" as default programs for feed opening.
I've also tried changing the:
*browser.feeds.handlers.application*
to:
/usr/local/bin/akadd
instead of:
/usr/bin/akregator
but that doesn't make any difference.
Hmmm. Interesting. When browser.feeds.handlers.application.args is empty I expected the URI to simply become the args (see the patch code). Perhaps simply deleting browser.feeds.handlers.application.args would work better. You should probably uncomment the debug statement to see what you are really getting.
However, if you are using the script for browser.feeds.handlers.application you probably don't need the browser.feeds.handlers.application.uriPrefix either. That may have contributed to some of that strange behavior. Check what the debug message says.
Also, if you always just want one feed to be added make sure your script only adds one feed. That script you are using can possibly add multiple feeds because it is using the for loop. Change it to add the arg you need.
As far as getting it to work without a script: My setup works without a script because akregator adds a feed if I issue
from the command line. It works with the '-a' option for me as well.
If you want it to work without using a script you need to figure out how akregator adds feeds from the command line for your system. Try running
Code:
akregator --help
and see what it tells you. Maybe kubuntu did something weird to akregator so it doesn't add feeds from the command line anymore. I could probably check this on another kubuntu box later this evening.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
Advertisement
Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Click Here to receive a complimentary subscription courtesy of LQ.