Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including subdb with all npm packages installed. Try it out:

var subdb = require("subdb")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

subdb v0.0.3

API to interact with subdb services

node-subdb-api

Node.js API library to query thesubdb.com

build status

Usage

  • All api methods are available through subdb.api attributes (see http://thesubdb.com/api/ for methods and arguments).
  • A hash method helper is also available
subdb.computeHash(path_to_movie, callback);

For searching a sub file

var SubDb = require("subdb");

var subdb = new SubDb();
subdb.computeHash(path_to_movie, function(err, res) {
    if(err) return err;

    var hash = res;
    subdb.api.search_subtitles(hash, function(err, res){

        if(err) return err;

        subdb.api.download_subtitle(hash, res.join(','), 'pathtosub.srt', function(err, res) {
            if(err) return err;

            // sub is normally fetched into pathtosub.srt
        });

    });
});

For uploading a sub file

var SubDb = require("subdb");

var subdb = new SubDb();
subdb.api.upload_subtitle(hash, subfile, function(err, res){
    if(err) return err;

    // sub subfile is normally uploaded to thesubdb.com servers
});

Metadata

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free