Page 1 of 1

FlashGot Integration

Posted: Sun Jul 21, 2013 5:00 am
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

Re: FlashGot Integration

Posted: Sun Jul 21, 2013 6:11 am
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) {   }

Re: FlashGot Integration

Posted: Sun Jul 21, 2013 3:13 pm
by Joe
Thanks :)

Re: FlashGot Integration

Posted: Mon Jul 22, 2013 2:37 pm
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?