md-movie-utils
Version:
The ultimate utility to get any information about a movie
228 lines (182 loc) • 11 kB
HTML
<html lang="en">
<head>
<meta charset="utf-8">
<title>md-movie-utils</title>
<script src="scripts/prettify/prettify.js"> </script>
<script src="scripts/prettify/lang-css.js"> </script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/bootstrap.min.css">
<link type="text/css" rel="stylesheet" href="styles/prettify-jsdoc.css">
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/tui-doc.css">
<link type="text/css" rel="stylesheet" href=".docs.styles.css">
</head>
<body>
<nav class="lnb" id="lnb">
<div class="logo" style="width: 162px; height: 76px">
<a href="https://dibosh.github.io/md-movie-utils/">
<img src="https://github.com/dibosh/md-movie-utils/raw/master/md-movie-utils-icon-invert.png" width="100%"
height="100%">
</a>
</div>
<div class="title">
<h1><a href="index.html" class="link"> </a></h1>
</div>
<div class="search-container" id="search-container">
<input type="text" placeholder="Search">
<ul></ul>
</div>
<div class="lnb-api hidden"><h3>Classes</h3><ul><li><a href="BaseClient.html">BaseClient</a><button type="button" class="hidden toggle-subnav btn btn-link"> <span class="glyphicon glyphicon-plus"></span></button><div class="hidden" id="BaseClient_sub"><div class="member-type">Methods</div><ul class="inner"><li><a href="BaseClient.html#get">get</a></li><li><a href="BaseClient.html#search">search</a></li></ul></div></li><li><a href="MovieDBClient.html">MovieDBClient</a><button type="button" class="hidden toggle-subnav btn btn-link"> <span class="glyphicon glyphicon-plus"></span></button><div class="hidden" id="MovieDBClient_sub"><div class="member-type">Methods</div><ul class="inner"><li><a href="MovieDBClient.html#.getInstance">getInstance</a></li><li><a href="MovieDBClient.html#get">get</a></li><li><a href="MovieDBClient.html#getByIMDBId">getByIMDBId</a></li><li><a href="MovieDBClient.html#getByTitleAndYear">getByTitleAndYear</a></li><li><a href="MovieDBClient.html#getDetails">getDetails</a></li><li><a href="MovieDBClient.html#search">search</a></li></ul></div></li><li><a href="OMDBAPIClient.html">OMDBAPIClient</a><button type="button" class="hidden toggle-subnav btn btn-link"> <span class="glyphicon glyphicon-plus"></span></button><div class="hidden" id="OMDBAPIClient_sub"><div class="member-type">Methods</div><ul class="inner"><li><a href="OMDBAPIClient.html#.getInstance">getInstance</a></li><li><a href="OMDBAPIClient.html#get">get</a></li><li><a href="OMDBAPIClient.html#getByIMDBId">getByIMDBId</a></li><li><a href="OMDBAPIClient.html#getByTitleAndYear">getByTitleAndYear</a></li><li><a href="OMDBAPIClient.html#search">search</a></li></ul></div></li><li><a href="Parser.html">Parser</a><button type="button" class="hidden toggle-subnav btn btn-link"> <span class="glyphicon glyphicon-plus"></span></button><div class="hidden" id="Parser_sub"><div class="member-type">Methods</div><ul class="inner"><li><a href="Parser.html#parseFromTorrentFileName">parseFromTorrentFileName</a></li><li><a href="Parser.html#parseMovieNameAndYear">parseMovieNameAndYear</a></li></ul></div></li></ul></div><div class="lnb-api hidden"><h3>Global</h3><ul><li><a href="global.html#toCamelCase">toCamelCase</a></li></ul></div>
</nav>
<div id="resizer"></div>
<div class="main" id="main">
<section>
<article class="readme">
<p class="badges">
<a href="https://travis-ci.org/dibosh/md-movie-utils">
<img src="https://travis-ci.org/dibosh/md-movie-utils.svg?branch=master" alt="Build Status">
</a>
<a href="">
<img src="https://img.shields.io/npm/dt/md-movie-utils.svg" alt="all downloads">
</a>
<a class="github-button"
href="https://github.com/dibosh/md-movie-utils"
data-icon="octicon-star" data-show-count="true"
aria-label="Star dibosh/md-movie-utils on GitHub">Star</a>
</p>
<h3><a href="https://dibosh.github.io/md-movie-utils">md-movie-utils</a></h3><p>All the movie info extraction utilities in one place. Has built-in,
easy to use OMDB and TMDB clients and more.</p>
<h4>Setup</h4><p><code>npm install md-movie-utils --save</code></p>
<h4>Usage</h4><ul>
<li><h5>Parsing movie name, year etc. basic info from torrent/plain file names</h5><pre class="prettyprint source"><code> let parser = require('md-movie-utils').parser;
// parse Murder on the Orient Express (2017) [BluRay] [1080p].mp4
parser.parseFromTorrentFileName('Murder on the Orient Express (2017) [BluRay] [1080p].mp4')
// returns
{
"year": 2017,
"resolution": "1080p",
"quality": "BluRay",
"title": "Murder on the Orient Express",
"excess": [
"[]",
"[]"
]
}
// parse Batman Begins (2005)
parser.parseMovieNameAndYear('Batman Begins (2005)', parser.formats.BRACES_FORMAT);
// returns
{
"movieName": "Batman Begins",
"year": 2005
}</code></pre></li>
<li><h5>Using Open Movie Database/The Movie Database clients</h5><ul>
<li><p>Initialize the client using your API key-</p>
<pre class="prettyprint source"><code> let movieDBClients = require('md-movie-utils').clients;
let omdbClient = movieDBClients.OMDBClient.getInstance(<YOUR_API_KEY>);
let tmdbClient = movieDBClients.MovieDBClient.getInstance(<YOUR_API_KEY>);</code></pre></li>
<li><p>Get info on any movie using the simple get methods-</p>
<pre class="prettyprint source"><code> // NB. You don't need to pass plot & format when using tmdbClient.
// For detailed instructions, please check the examples or the class
// documentations.
let movieRequest = {
title: 'Thor Ragnarok',
year: 2017,
format: 'json',
plot: 'full',
type: 'movie'
};
omdbClient/* Or tmdbClient */.get(movieRequest)
.then((data) => {
console.log(data); // Thor Ragnarok movie info is here!
});
// or using the IMDB ID
let movieRequest = {
imdbID: 'tt2345',
format: 'json',
plot: 'full',
type: 'movie'
};
omdbClient/* Or tmdbClient */.get(movieRequest)
.then((data) => {
console.log(data); // Movie info is here!
});</code></pre></li>
<li><p>Or even simply using the helper methods-</p>
<pre class="prettyprint source"><code>
omdbClient/* Or tmdbClient */.getByTitleAndYear(title, year)
.then((data) => {
console.log(data); // Movie info is here!
});
// or using the IMDB ID
omdbClient/* Or tmdbClient */.getByIMDBId(imdbID)
.then((data) => {
console.log(data); // Movie info is here!
});</code></pre></li>
<li><p>You can also search for a movie/series-</p>
<pre class="prettyprint source"><code> let searchRequest = {
query: 'Saw'
};
omdbClient/* Or tmdbClient */.search(searchRequest)
.then((data) => {
console.log(data); // Movie info(s) is here!
});</code></pre></li>
</ul>
</li>
</ul>
<h4>Examples</h4><p>Check out the detailed usage <a href="https://github.com/dibosh/md-movie-utils/tree/master/example">here</a>.</p>
<p>To test out the API created in examples, just clone the <a href="https://github.com/dibosh/md-movie-utils">repository</a>
and then replace api keys with yours in <code>md-movie-utils/example/server.js</code></p>
<p>Then run the server- <code>npm install && npm run examples</code></p>
<p>The Example API should now be available for testing-</p>
<p><code>localhost:3000</code></p>
<ul>
<li><code>/omdb/get?title=Saw&year=2004&type=movie</code></li>
<li><code>/omdb/movie/getByTitleAndYear?title=Saw&year=2004</code></li>
<li><code>/omdb/series/getByTitleAndYear?title=Saw&year=2004</code></li>
<li><code>/omdb/search?q=Batman</code></li>
<li><code>/tmdb/get?title=Saw&year=2004&type=movie</code></li>
<li><code>/tmdb/movie/getByTitleAndYear?title=Saw&year=2004</code></li>
<li><code>/tmdb/series/getByTitleAndYear?title=Saw&year=2004</code></li>
<li><code>/tmdb/get/:imdbID</code></li>
<li><code>/tmdb/search?q=The Dark Knight</code></li>
<li><code>/extract/fromTorrent?fileName=Murder on the Orient Express (2017) [BluRay] [1080p].mp4</code></li>
<li><code>/extract/plain?fileName=Murder on the Orient Express (2017) [BluRay] [1080p].mp4&format=DOT_FORMAT</code></li>
</ul>
<h4>The MIT License</h4><p>Copyright 2018 © <strong>Munim Dibosh</strong></p>
<p>Permission is hereby granted, free of charge, to any person obtaining a copy of this
software and associated documentation files (the "Software"), to deal in the Software
without restriction, including without limitation the rights to use, copy, modify,
merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to the following
conditions:</p>
<p>The above copyright notice and this permission notice shall be included in all copies
or substantial portions of the Software.</p>
<p>THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.</p></article>
</section>
</div>
<footer>
<img class="logo" src="https://github.com/dibosh/md-movie-utils/raw/master/md-movie-utils-icon-invert.png" style="width: 162px; height: 76px">
<div class="footer-text">If you liked the module, don't forget to hit a star on github: https://github.com/dibosh/md-movie-utils</div>
</footer>
<script>prettyPrint();</script>
<script src="scripts/jquery.min.js"></script>
<script src="scripts/tui-doc.js"></script>
<script src="scripts/linenumber.js"></script>
<script>
var id = 'package:undefined_sub'.replace(/"/g, '_');
var selectedApi = document.getElementById(id); // do not use jquery selector
var $selectedApi = $(selectedApi);
$selectedApi.removeClass('hidden');
$selectedApi.parent().find('.glyphicon').removeClass('glyphicon-plus').addClass('glyphicon-minus');
showLnbApi();
</script>
<script async defer src="https://buttons.github.io/buttons.js"></script>
</body>
</html>