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

dsub

v1.2.0

Published

An awesome subtitles downloader.

Downloads

11

Readme

dsub

An awesome subtitles downloader.

screenshot

FAQ

What it does?

It downloads subtitles for movies and TV shows.

Which subtitles sources does it use?

Right now it uses OpenSubtitles and the plan is to add more sources in the future.

How it works?

First, it tries to do an exact match for the video files you're searching subs for.

If no subs are found, it runs a query using the video filename.

Subs are downloaded in the subs folder by default, where they are automatically read by VLC, one of the best video players out there.

CLI install

npm install -g dsub

Dependency install

npm install --save dsub

CLI usage

dsub: Download subs for all video files in current folder.

dsub --name='Awesome Movie': Download subs for a movie named Awesome Movie.

dsub --verbose: Displays errors when it finishes.

dsub --debug: Displays debug info.

dsub --ignore='sample|extra': Ignore files with sample or extra in the filename.

dsub --src='~/Movies/sintel': Download subs for all files in ~/Movies/sintel. Defaults to current directory.

dsub --dest='~/Movies/sintel': Download subs in ~/Movies/sintel. Defaults to ./subs, creates the folder if it doesn't exist.

dsub --lang='spa': Download spanish subs. Use these language codes as reference.

dsub --all: Ignores exact matching and uses a query to download all available subs.

Programatic usage

const Dsub = require('dsub')
const dsub = new Dsub({name, src, dest, lang, noExtract, debug, ignore})
dsub
  .on('searching', ({file}) => {
    // Called each time searching starts.
    // Searching is sequential for each video file found.
    // `file` is the current video file we're searching subs for.
  })
  .on('login', ({file, token}) => {
    // Called after logged in to subtitles provider.
    // `file` is the current video file we're searching subs for.
    // `token` is the subtitles provider token used for searching.
  })
  .on('downloading', ({file, total}) => {
    // Called every time a subtitles file starts downloading.
    // `file` is the current video file we're downloading subs for.
    // `total` is the amount of subs there are left to be downloaded for this file.
  })
  .on('extracting', ({file, total}) => {
    // Called when extracting subs.
    // `file` is the current video file we're extracting subs for.
    // `total` is the amount of subs there are left to be extracted for this file.
  })
  .on('cleanup', ({file, total}) => {
    // Called once after all subs have been downloaded for this file.
    // The cleanup process involves deleting all compressed files.
    // `file` is the current video file we're cleaning up for.
    // `total` is the amount of files needed to cleanup.
  })
  .on('partial', ({time, total, file}) => {
    // Called once after all subs finished downloading and extracting for this file.
    // Occurs after cleanup.
    // `time` is the total amount of time elapsed while processing this file.
    // `total` is the total amount of downloaded subs for this file.
    // `file` is the current video file we downloaded subs for.
  })
  .on('done', ({time, totalFiles, totalSubs}) => {
    // Called after all subs where downloaded for all files.
    // `time` is the total amount of time elapsed while processing all files.
    // `totalFiles` is the total amount of processed video files.
    // `totalSubs` is the total amount of downloaded subs for all files.
  })
  .on('empty', ({file}) => {
    // Called when there are no subs for this video file.
    // `file` is the current video file we searched subs for.
  })
  .on('error', (error) => {
    // Called when errors occur.
    // `error` is the error object or string.
  })
  .download() // Calling `download()` starts the download process.

Enjoy!