leranjun / subsrt-ts Goto Github PK
View Code? Open in Web Editor NEWSubtitle JavaScript library and command line tool with no dependencies.
Home Page: https://www.npmjs.com/package/subsrt-ts
License: MIT License
Subtitle JavaScript library and command line tool with no dependencies.
Home Page: https://www.npmjs.com/package/subsrt-ts
License: MIT License
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.
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;
.*\r?\n
matches with the style and the new lineIn the second caption;
.*\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.Lines 40 to 42 in 862a66d
This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.
These updates have all been created already. Click a checkbox below to force a retry/rebase of any.
@typescript-eslint/eslint-plugin
, @typescript-eslint/parser
).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
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.