npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

tvdb

v0.0.13

Published

A wrapper for thetvdb.coms XML API

Downloads

15

Readme

TheTVDB.com Node library Version 0.0.13

Build status (Master)
Build status (Development)

It's a wrapper for thetvdbs XML API, written in CoffeeScript for node. You won't be in contact with any XML if you use this library.

The library isn't finished yet. I'll update this README as I get along so you'll know what to expect.

You can check out thetvdbs programmers API to know what this library will be wrapping.

This project uses semantic versioning and uses this tag script to tag the versions.

I use the great mocha testing framework with the (also great) should assertion library for testing.
If you contribute to this project, please write a test, and make sure all existing tests pass.

Usage

First off, get an API key from thetvdb. Withouth an API key you won't be able to do anything with this library.

All code samples are presented in both, Javascript and CoffeScript.

Include and configure the library

// JS
var TVDB = require("tvdb")
  , tvdb = new TVDB({ apiKey: "YOUR_KEY" });

# Coffee
TVDB = require("tvdb")
tvdb = new TVDB apiKey: "YOUR_KEY"

Possible configuration options are:

  • apiKey {String}
  • language {String} (optional) Default: "en". Use getLanguages() if you want another language.
  • initialHost {String} (optional) Default: "thetvdb.com"
  • port {Number} (optional) Default: 80

Get available languages

// JS
tvdb.getLanguages(function(err, languages) {
  if (err) return;
  // Handle languages.
};

# Coffee
tvdb.getLanguages (err, languages) ->
  if err? then return
  # Handle languages

TVDB uses "en" (english) as default when it fetches data. If you want another language, use this function, get the language you want (or let the user decide which language s/he wants) and use the abbreviation as new language.

To set the language as new default, simply call:

// JS
tvdb.setLanguage(language.abbreviation);

# Coffee
tvdb.setLanguage language.abbreviation

Get a list of mirrors

// JS
tvdb.getMirrors(function(err, mirrors) {
  if (err) return;
  // Handle mirrors.
});

# Coffee
tvdb.getMirrors (err, mirrors) ->
  if err? then return
  # Handle mirrors

Mirrors is an Array containing objects that are formatted like this:

{ id: "1", url: "http://thetvdb.com", types: [ "xml", "banner", "zip" ] }

types contains at least one of "xml", "banner" and "zip".

Get server time

// JS
tvdb.getServerTime(function(err, time) {
  if (err) return;
  // Handle time.
};

// Coffee
tvdb.getServerTime (err, time) ->
  if err? then return
  # Handle time

time is an integer.

Find a TV Show

// JS
tvdb.findTvShow("Mad Men", function(err, tvShows) {
  if (err) return;
  // Handle tvShows.
};

# Coffee
tvdb.findTvShow "Mad Men", (err, tvShows) ->
  if err? then return
  # Handle tvShows

tvShows is an array of tvShow objects which contain following obligatory values:

  • id {String}
  • language {String}
  • name {String}

and following optional values:

  • firstAired {Date}
  • imdbId {String}
  • zap2itId {String}
  • banner {String}
  • overview {String}