LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This 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

Reply
 
Search this Thread
Old 12-09-2007, 02:00 PM   #1
shadowsnipes
Senior Member
 
Registered: Sep 2005
Distribution: Slackware
Posts: 1,441

Rep: Reputation: 70
Subscribing to RSS Feeds in Firefox 2.0 for Akregator


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)?

I appreciate any help.
 
Old 12-13-2007, 01:27 AM   #2
shadowsnipes
Senior Member
 
Registered: Sep 2005
Distribution: Slackware
Posts: 1,441

Original Poster
Rep: Reputation: 70
any ideas? anyone?
 
Old 12-29-2007, 01:19 AM   #3
shadowsnipes
Senior Member
 
Registered: Sep 2005
Distribution: Slackware
Posts: 1,441

Original Poster
Rep: Reputation: 70
**************************bump******************
 
Old 02-08-2008, 08:36 PM   #4
okaoka
LQ Newbie
 
Registered: Feb 2008
Location: Montreal, Qc
Distribution: Ubuntu, Sabayon
Posts: 4

Rep: Reputation: 0
Smile

Hello,

I just installed Akregator yesterday and got into the same problem as you. I found the solution here: http://porpoisehead.net/hi/?q=node/25

That's the easiest I've found and it worked great right away.

I am using Ubuntu (Hardy Heron). Hopefully it will help you too...

Last edited by okaoka; 02-08-2008 at 08:42 PM.
 
Old 02-09-2008, 12:23 AM   #5
shadowsnipes
Senior Member
 
Registered: Sep 2005
Distribution: Slackware
Posts: 1,441

Original Poster
Rep: Reputation: 70
Quote:
Originally Posted by okaoka View Post
Hello,

I just installed Akregator yesterday and got into the same problem as you. I found the solution here: http://porpoisehead.net/hi/?q=node/25

That's the easiest I've found and it worked great right away.

I am using Ubuntu (Hardy Heron). Hopefully it will help you too...
I appreciate your response, but unfortunately, I already tried that and it didn't work for some reason (see my original post).

Any other ideas? Anybody get this working in Slackware?
 
Old 02-09-2008, 10:07 AM   #6
okaoka
LQ Newbie
 
Registered: Feb 2008
Location: Montreal, Qc
Distribution: Ubuntu, Sabayon
Posts: 4

Rep: Reputation: 0
Funny,
I tested your code:

Code:
#!/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.
 
Old 02-09-2008, 02:02 PM   #7
shadowsnipes
Senior Member
 
Registered: Sep 2005
Distribution: Slackware
Posts: 1,441

Original Poster
Rep: Reputation: 70
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.
 
Old 02-09-2008, 02:25 PM   #8
shadowsnipes
Senior Member
 
Registered: Sep 2005
Distribution: Slackware
Posts: 1,441

Original Poster
Rep: Reputation: 70
The Slackware Solution

I found this solution posted at http://linlog.skepticats.com/entries...eeds_fixed.php which points to the main source at http://forums.mozillazine.org/viewtopic.php?t=480357.

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 02:28 PM. Reason: code formatting
 
Old 02-09-2008, 03:19 PM   #9
shadowsnipes
Senior Member
 
Registered: Sep 2005
Distribution: Slackware
Posts: 1,441

Original Poster
Rep: Reputation: 70
Apparently the big difference must be that
Code:
process.run(false, args, args.length);
actually runs the script/binary while
Code:
ss.openApplicationWithURI(clientApp, spec);
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?
 
Old 02-12-2008, 07:00 PM   #10
tzd
LQ Newbie
 
Registered: Feb 2008
Posts: 3

Rep: Reputation: 0
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.
 
Old 02-12-2008, 11:18 PM   #11
shadowsnipes
Senior Member
 
Registered: Sep 2005
Distribution: Slackware
Posts: 1,441

Original Poster
Rep: Reputation: 70
Try making browser.feeds.handlers.application.args set to nothing (empty string).

Just out of curiosity, does adding feeds to akregator from the command line work?

Try
Code:
/usr/bin/akregator --addfeed http://feed43.com/wesnoth.xml
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.
 
Old 02-14-2008, 06:26 AM   #12
tzd
LQ Newbie
 
Registered: Feb 2008
Posts: 3

Rep: Reputation: 0
Ok I've tried your suggestions now

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.
 
Old 02-14-2008, 03:26 PM   #13
shadowsnipes
Senior Member
 
Registered: Sep 2005
Distribution: Slackware
Posts: 1,441

Original Poster
Rep: Reputation: 70
Quote:
Originally Posted by tzd View Post
Ok I've tried your suggestions now

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
Code:
/usr/bin/akregator --addfeed http://somerandomfeed.xml
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.
 
  


Reply

Tags
akregator, firefox


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Akregator doesn't remember feeds adriv Slackware 11 09-03-2007 03:19 PM
LXer: Reading feeds efficiently with Akregator LXer Syndicated Linux News 0 06-26-2006 03:21 PM
Can't add feeds to Akregator bestiarosa MEPIS 0 12-09-2005 07:57 AM
RSS Feeds in Firefox dudeman41465 Linux - Software 3 11-14-2005 07:57 PM
RSS Feeds (HELP) webwolf70 Programming 1 02-07-2005 09:08 AM


All times are GMT -5. The time now is 05:54 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration