Giter VIP home page Giter VIP logo

vtt-creator's Introduction

vtt-creator

npm version Build Status codecov.io

Very basic and experimental Node.js/JavaScript library to generate VTT open subtitles files

Install

With NPM:

npm install --save vtt-creator

or with Bower:

With NPM:

bower install --save vtt-creator

Example

To include Vtt in your Node.js project simply use:

var Vtt = require('vtt-creator');

or in a fronted app using bower (Vtt will be available as a global instance):

<script src="bower_components/vtt-creator/dist/vtt.min.js"></script>

Usage:

var v = new Vtt();
v.add(1.05, 4, 'Never drink liquid nitrogen.', 'align:middle line:84%');
v.add(5, 9, ['It will perforate your stomach.', 'You could die.']);

console.log(v.toString());

the previous snippet will generate:

WEBVTT

1
00:00:01.050 --> 00:00:04.000 align:middle line:84%
Never drink liquid nitrogen.

2
00:00:05.000 --> 00:00:09.000
It will perforate your stomach.
You could die.

Contributing

Everyone is very welcome to contribute to this project. You can contribute just by submitting bugs or suggesting improvements by opening an issue on GitHub.

License

Licensed under MIT License. © Luciano Mammino.

vtt-creator's People

Contributors

camfraser avatar lmammino avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

vtt-creator's Issues

bug in function pad()

Hi, thanks for sharing this useful code. I noticed a bug in function pad(), that results in incorrect padding on 9:

e.g. "00:00:05.923 --> 00:00:9.026"
instead of:
"00:00:05.923 --> 00:00:09.026"

Here's a fix:
function pad(num) {
if (num < 10) {
return '0' + num;
}
...

If you could update your npm as well that would be awesome. Thanks!

Christian

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.