goatandsheep / node-srt

Parse SRT files, segments and generates HLS playlists for them
https://www.npmjs.com/package/node-srt
MIT License
4 stars 1 forks source link

Wrong format on srt #20

Open niklasnilsson87 opened 3 years ago

niklasnilsson87 commented 3 years ago

if I send in

1
00:00:13,960 --> 00:00:18,416
I cannot believe it.

It throws an error, Isn't the correct format on srt with a " , " at millisecond?

gregmsanderson commented 2 years ago

Yep, you are right. I've just found the same. A valid .srt file fails to parse because of that.

Guessing it's a result of the regex checking for a WebVTT-style time (so not allowing a comma):

https://github.com/goatandsheep/node-srt/blob/master/lib/parser.js#L14

kms0219kms commented 2 months ago

@niklasnilsson87 @gregmsanderson I just replaced all ,s to .s to work around this issue on my fork, waktaplay/node-srt-ts.

Can you try in this way? (https://github.com/waktaplay/node-srt-ts/blob/v3.0.4/src/lib/parser.ts#L132, https://github.com/waktaplay/node-srt-ts/blob/v3.0.4/src/lib/parser.ts#L144, https://github.com/waktaplay/node-srt-ts/blob/v3.0.4/src/lib/parser.ts#L149)