0.0.8 • Published 9 years ago
shooter v0.0.8
shooter.js
fetch subtitle from shooter.cn
Install
via
npm
:npm install -g shooter
via
git
:git clone https://github.com/zyxar/shooter.js cd shooter.js/ npm install -g
Example
var Fn = require('..').API.fetch;
var path = require('path');
var args = process.argv;
// argv[0] === 'node'
// argv[1] === 'XXX/bin/main.js'
args = args.slice(2);
args.map(function (current, index, array) {
Fn(current, function(err, res) {
if (!err) {
console.log(path.basename(current), '->', res);
} else {
console.log(err);
}
});
});
Funcs
API.getHash(file)
- return
string
ornull
; - get four slice (4096) md5 hash values;
- return
API.submit(callback)
- should be called after
getHash()
; - get subtitle information of the film file;
callback(error, list)
, list is supposed to be an array with each element a metadata of a subtitle file;
- should be called after
API.fetch(file, callback)
- all-in-one
Class
FilmFile
:function FilmFile (fullpath) {/*...*/}; FilmFile.prototype.parse = function(fullpath) {/*...*/}; FilmFile.prototype.fetch = function(callback) {/*...*/};
Note
- basic support for
http_proxy
orHTTP_PROXY
;