FlashGot Integration

Ask for help about FlashGot, no registration needed to post
Post Reply
joe_e

FlashGot Integration

Post by joe_e »

Hi,

I am trying to integrate my extension with FlashGot. Here is the code I am using

Code: Select all

    var flashgot = Cc["@maone.net/flashgot-service;1"]
      .getService(Ci.nsISupports).wrappedJSObject;
    try {
      flashgot.download([{
        href: link,
        fname : title
      }], flashgot.OP_ALL, flashgot.defaultDM);
    }
    catch (e) {   }
It works okay for all download managers except DownThemAll. If I set my default downloader to dTa by executing this code noting happens (no error in Error Console as well); however, if I set the download manager to something else like FlashGet, the code brings up the manager. Any idea what could case this?

Thanks
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:22.0) Gecko/20100101 Firefox/22.0
User avatar
Giorgio Maone
Site Admin
Posts: 9524
Joined: Wed Mar 18, 2009 11:22 pm
Location: Palermo - Italy
Contact:

Re: FlashGot Integration

Post by Giorgio Maone »

DTA integration requires a "document" expando property on the links array you're passing to be set with the document the link is taken from, or its best approximation.
If you're in the chrome window content, for instance, your code would become something like

Code: Select all

 var flashgot = Cc["@maone.net/flashgot-service;1"]
      .getService(Ci.nsISupports).wrappedJSObject;
  var links = ([{
        href: link,
        fname : title
      }];
  links.document = content.document;
    try {
      flashgot.download, flashgot.OP_ALL, flashgot.defaultDM);
    }
    catch (e) {   }
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:22.0) Gecko/20100101 Firefox/22.0
Joe

Re: FlashGot Integration

Post by Joe »

Thanks :)
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:22.0) Gecko/20100101 Firefox/22.0
joe

Re: FlashGot Integration

Post by joe »

I have another question. It seems that "fname" doesn't change the final file name when I send a link to dTa from FlashGot. It works fine in other downloader though. In case of dTa the name is being extracted from link, not "fname". Any idea how to fix this?
Mozilla/5.0 (X11; Linux i686; rv:22.0) Gecko/20100101 Firefox/22.0
Post Reply