subfil
v1.1.1
Published
Command-line app to download subtitles
Downloads
11
Maintainers
Readme
subfil
Command-line app for downloading subtitles
CLI
$ npm install -g subfil
$ subfil "spiderman.avi" --language pt --destination subtitles.srt
$ subfil -r ~/Videos
Info
subfil
uses the SubDB API to download subtitles. All API calls require a unique hash of the video for which subtitles are required. Refer to the
API Documentation to see how the hash is generated.
API
$ npm install --save subfil
// List available languages for hash
subfil.getLanguages(hash, callback);
A filename
can also be provided instead of the hash
. The callback gets two arguments (err, languages)
where languages
is an array of the available languages.
// Download subtitles for hash
subfil.download(hash[, options], callback);
A filename
or a directory
can also be provided instead of the hash
. Multiple hashes, filenames or directories can also be provided.
The options
object contains the following properties:
language
- The language in which the subtitles must be downloaded. It defaults toen
.destination
- The destination to which the subtitles must be downloaded. It defaults to a file intmp
directory for hash and ansrt
file in the same folder for a filename.recursive
- Whether to expand directories or not. It defaults tofalse
. In case of a non-recursive download, directories give a status ofINVALID_VIDEO_FILE
.
Note: The destination
parameter currently only works for a single hash or filename.
The callback gets four arguments (err, status, destination, file)
where status
is the result from the SubDB API, destination
is the filename to which the subtitles are downloaded and file
is the filename or hash which was used to download a particular subtitle. An array is returned for the three if multiple subtitles are downloaded.
License
MIT © Divij Bindlish