jaruba / multipass-torrent

Collects information about torrents from various sources (dump, RSS, HTML pages) and associates the video files within with IMDB ID - stores data in a distributed DB
MIT License
80 stars 18 forks source link

Better JS API #15

Open jaruba opened 9 years ago

jaruba commented 9 years ago

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 commented 9 years ago

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 commented 9 years ago

lol, you created a conflict with this commit: https://github.com/Ivshti/multipass-torrent/commit/4b3a0160f58bf5f71c7c767530e05e0702fd96cb :))

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 commented 9 years ago

I swear torrage was alive recently.

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

jaruba commented 9 years ago

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 commented 9 years ago

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 commented 9 years ago

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