Git Product home page Git Product logo

subtitles-parser's People

Contributors

bazh avatar caridy avatar eddolan 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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

subtitles-parser's Issues

Typo in README in npmjs.org version

This page incorrectly shows the install command as npm install subtitle-parser whereas the README in Github repo is correct.

Looks like this wasn't npm published after recent changes?

async

Hi, would you consider approaching this in an async way? Where instead of

var data = parser.fromSrt(srt);

You would do

parser.fromSrt(srt, function(data){
   // some code
});

or (with q)

parser.fromSrt(srt).then(function(data){
   // some code
});

Theoretically, this would allow for faster parsing of multiple subtitle files (i think).

Does not work when there's no comment

if smi file dosen't have any comment, parser spout error.

subtitle-convert/lib/parser/smiparser.js 's 71 line.

 parser.end();
  var regex = new RegExp('<!--[\\s\\S]*?(?:-->)?' + '<!---+>?' + '|<!(?![dD][oO][cC][tT][yY][pP][eE]|\\[CDATA\\[)[^>]*>?' + '|<[?][^>]*>?', 'g');
  encoded.match(regex).forEach(function (el) {
    commentList.push(el.replace(/(\r\n){2}|(<!--)|(-->)|/g, '').replace(/^(\r\n)/g, ''));
  });
  return {
    styleList: styleList,
    cueList: cueList,
    commentList: commentList
  };

to

parser.end();
  try {
    var regex = new RegExp('<!--[\\s\\S]*?(?:-->)?' + '<!---+>?' + '|<!(?![dD][oO][cC][tT][yY][pP][eE]|\\[CDATA\\[)[^>]*>?' + '|<[?][^>]*>?', 'g');
    encoded.match(regex).forEach(function (el) {
      commentList.push(el.replace(/(\r\n){2}|(<!--)|(-->)|/g, '').replace(/^(\r\n)/g, ''));
    });
  } catch{
    
  }
  return {
    styleList: styleList,
    cueList: cueList,
    commentList: commentList
  };

Support for other formats

00:00:03.14,00:00:05.37
All right, they got water,[br]orange juice. . .

00:00:05.74,00:00:08.01
. . .and what looks like cider.

and

{488}{511}Hey, Ben.
{517}{593}"Just do it"!
{609}{638}Oh, my God!

Does not work when using dots as decimal separator

The fromSrt() function does not work when dots are used as decimal separator (instead commas).
For example:

1
00:00:04.240 --> 00:00:09.570
way.

2
00:00:09.570 --> 00:00:10.860
Love about Eurovision.

3
00:00:11.080 --> 00:00:16.050
The whole world's participating on to make sure the world remains a great place that

4
00:00:16.050 --> 00:00:16.450
it is.

5
00:00:16.640 --> 00:00:19.850
We're hosting this song contest as a green events,

Apparently it works well with both commas and dots when changing the regex at line 21:
var regex = /(\d+)\n(\d{2}:\d{2}:\d{2},\d{3}) --> (\d{2}:\d{2}:\d{2},\d{3})/g;
to:
var regex = /(\d+)\n(\d{2}:\d{2}:\d{2}.\d{3}) --> (\d{2}:\d{2}:\d{2}.\d{3})/g;

hi bazh

hi thank you your npm

npm install subtitles-parser
this is correct

but this page incorrect word
npm install subtitles-parser
2015-12-23 8 44 40

Does not work when using dots as decimal separator

The fromSrt() function does not work when dots are used as decimal separator (instead commas).
For example:

1
00:00:04.240 --> 00:00:09.570
way.

2
00:00:09.570 --> 00:00:10.860
Love about Eurovision.

3
00:00:11.080 --> 00:00:16.050
The whole world's participating on to make sure the world remains a great place that

4
00:00:16.050 --> 00:00:16.450
it is.

5
00:00:16.640 --> 00:00:19.850
We're hosting this song contest as a green events,

Apparently it works well with both commas and dots when changing the regex at line 21:
var regex = /(\d+)\n(\d{2}:\d{2}:\d{2},\d{3}) --> (\d{2}:\d{2}:\d{2},\d{3})/g;
to:
var regex = /(\d+)\n(\d{2}:\d{2}:\d{2}.\d{3}) --> (\d{2}:\d{2}:\d{2}.\d{3})/g;

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.