Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better JS API #15

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open

Better JS API #15

wants to merge 12 commits into from

Conversation

jaruba
Copy link
Owner

@jaruba jaruba commented Oct 31, 2015

Usage:

parseLink = [some-link];

multipass = require('multipass-torrent/cli/multipass');

// can only be initialized once
multipass.init({
    dbPath: "C:\\niftyDB",
    replicate: false,
    minSeedImportant: 5
    // can overwrite any params from defaults.js and /lib/cfg.js
});

multipass.on("found",function(source,torrent) {
    if (source == parseLink) {
        console.log("Found Torrent:");
        console.log(torrent);
    }
});

multipass.on("buffering",function(source,perc) {
    if (source == parseLink) {
        console.log("Source: "+source);
        console.log("Percent: "+perc);
    }
});

multipass.on("finished",function(source) {
    if (source == parseLink) {
        console.log("Finished with Source: "+source);
    }               
});

multipass.import(parseLink);

@jaruba
Copy link
Owner Author

jaruba commented Oct 31, 2015

I'm not entirely sure if it's related to my changes (it shouldn't be), but I'm only getting an object with 1 error (to be precise: "Did not manage to download parsable torrent"), instead of the usual 3, when torrents fail to download.

^ I was wrong, it works correctly.

I haven't yet tested running it from the terminal to see if everything goes well..

@jaruba
Copy link
Owner Author

jaruba commented Oct 31, 2015

lol, you created a conflict with this commit: 4b3a016 :))

I removed both YTS and Torrage as their both offline and I don't think they are ever coming back again. I replaced them with 2 less known torrent cache services, that I've tested and seem to work (for now). :)

@Ivshti
Copy link
Collaborator

Ivshti commented Oct 31, 2015

I swear torrage was alive recently.

and we've got dns issues with torcache, so we have to figure this out

@jaruba
Copy link
Owner Author

jaruba commented Oct 31, 2015

I swear torrage was alive recently.

http://torrage.com/ (which was the one in the code) seems dead for a while, i hope your not confusing it with http://torrage.info/ though, we can't use torrage.info because it requires user interaction to download the torrent. (unless it allows us to post the torrent hash to it's download.php page)

@jaruba
Copy link
Owner Author

jaruba commented Oct 31, 2015

There's one more torrent cache server i've found, but it requires a bit more complex logic then the others so I skipped it for now.

'http://bt.box.n0808.com/' + hash.slice(0, 2) + '/' + hash.slice(-2) + '/' + hash + '.torrent';

@Ivshti
Copy link
Collaborator

Ivshti commented Nov 24, 2015

SEveral notes @jaruba :

  1. this new source can be implemented as a separate retriever; the indexer supports passing custom retriver
  2. in this case, we have to move cli/multipass to only multipass.js or index.js
  3. let's make a branch 1.0, merging this into it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants