Giter Site home page Giter Site logo

leranjun / subsrt-ts Goto Github PK

View Code? Open in Web Editor NEW
14.0 14.0 3.0 6.93 MB

Subtitle JavaScript library and command line tool with no dependencies.

Home Page: https://www.npmjs.com/package/subsrt-ts

License: MIT License

JavaScript 11.62% Batchfile 0.03% TypeScript 88.34%

subsrt-ts's Introduction

GitHub stats GitHub achievements and trivia

Empty

HIMEHINA Now Hot HIMEHINA Updates

Empty

Vistor count

subsrt-ts's People

Contributors

deepsource-io[bot] avatar dnjstlr555 avatar frost768 avatar github-actions[bot] avatar leranjun avatar mend-bolt-for-github[bot] avatar papnkukn avatar renovate[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

subsrt-ts's Issues

bug(vtt): multiline caption new line removal

As stated in #2 before, currently new lines in multiline captions are replaced with spaces which can cause a problem in the captions that have more than one speaker at the current time of the video. In this situtation, subtitle editors mostly denote each speaker with a hyphen (-), words they say and a new line. Hence resulting in outputs as -Where were you? - At the store.
This may confuse people when reading the caption because of this I suggest keeping the content of the caption as it is.

Multiline subtitles

First of all thanks for this great library and conversion to typescript.
The problem is that the regex in vtt doesn't capture the first line of a multiline subtitle.
For example:

WEBVTT

00:00:00.000 --> 00:00:10.000 position:45%,line-right align:center size:35%
- Hey
- Hi

00:00:11.000 --> 00:00:20.000
- Hey
- Hi

The first caption's output is '-Hey -Hi' but the second one's is just '- Hi'.
I believe it is related to \s?.*\r?\n regex before the text group ([\s\S]*).
It matches with the first line and completely disregards it.
Explanation:
In the first caption;

  • `\s?' matches with the space between the times and style
  • .*\r?\n matches with the style and the new line

In the second caption;

  • `\s?' doesn't match anything because there is no space
  • .*\r?\n matches with - Hey because it takes every character until it comes across with a new line which also happens to be the first line of the caption.

const regex =
/^([^\r\n]+\r?\n)?((?:\d{1,2}:)?\d{1,2}:\d{1,2}(?:[.,]\d{1,3})?)\s*-->\s*((?:\d{1,2}:)?\d{1,2}:\d{1,2}(?:[.,]\d{1,3})?)\s?.*\r?\n([\s\S]*)$/;
const match = regex.exec(parts[i]);

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/deploy-docs.yml
  • actions/checkout v3
  • actions/cache v3
  • actions/setup-node v3
  • actions/configure-pages v3
  • actions/upload-pages-artifact v2
  • actions/deploy-pages v2
.github/workflows/lint-and-test.yml
  • actions/checkout v3
  • actions/cache v3
  • actions/setup-node v3
  • wearerequired/lint-action v2
.github/workflows/release-please.yml
  • google-github-actions/release-please-action v3
  • actions/checkout v3
  • actions/setup-node v3
npm
package.json
  • @types/jest ^29.5.1
  • @types/node ^18.16.2
  • @typescript-eslint/eslint-plugin ^5.59.1
  • @typescript-eslint/parser ^5.59.1
  • eslint ^8.39.0
  • eslint-config-prettier ^8.8.0
  • eslint-import-resolver-typescript ^3.5.5
  • eslint-plugin-import ^2.27.5
  • eslint-plugin-jest ^27.2.1
  • eslint-plugin-regexp ^1.14.0
  • jest ^29.5.0
  • prettier ^3.0.0
  • ts-jest ^29.1.0
  • typedoc ^0.25.0
  • typedoc-plugin-missing-exports ^2.0.0
  • typescript ^5.0.4
  • yarn 3.6.3

  • Check this box to trigger a request for Renovate to run again on this repository

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.