mantas-done / subtitles

Subtitle/caption converter
https://gotranscript.com/subtitle-converter
MIT License
142 stars 48 forks source link

VttConverter should have a stricter time parser #86

Closed leo108 closed 10 months ago

leo108 commented 10 months ago

If a webvtt file contains a text line which has two timestamp, it will be treated as a cue timing:

\Done\Subtitles\Subtitles::loadFromString(<<<EOT
WEBVTT
00:00.410 --> 00:04.286
Hey, let's meet on
00:04.308 --> 00:06.670
08:00 next Thursday, or 09:00
EOT
, 'vtt');

The code above will throw a Done\Subtitles\Code\UserException with message Time doesn't have milliseconds: 08:00., this is because the line 08:00 next Thursday, or 09:00 was parsed as a cue timing line here https://github.com/mantas-done/subtitles/blob/master/src/Code/Converters/VttConverter.php#L27

mantas-done commented 10 months ago

Thank you for reporting this problem. Fixed it on the dev branch https://github.com/mantas-done/subtitles/commit/1c2ec045698ebc81c2d9a61944012ed419b7c6ed. In the composer file you can use to get the newest fix: "mantas-done/subtitles": "dev-master",

leo108 commented 9 months ago

@mantas-done Awesome, do you have any plan to release a new version?

mantas-done commented 9 months ago

@leo108 made a new release https://github.com/mantas-done/subtitles/releases/tag/v1.0.18