srt-parser icon indicating copy to clipboard operation
srt-parser copied to clipboard

Improving handling of empty timestamps in the parser.

Open bucefal91 opened this issue 6 years ago • 1 comments

Hey! Thank you for the library :)

We have applied it to our particular use case and it does pretty good job. The only problem we've discovered is that our subtitles (which are auto-generated by 3rd party vendor), sometimes could have a bit strange entries with just empty text, i.e. it would specify some timestamp but would not specify any text/wording for that time interval, just an empty line. Let me show an example:

1
00:00:00,000 --> 00:00:00,500


2
00:00:00,500 --> 00:00:05,600
I was asked to verify that I did
not file a Federal income tax

You see the section first section does not specify any text, just an empty line (an empty text, if you like). It was generating some PHP notices, so I opted to patch a bit the parser logic.

bucefal91 avatar May 20 '19 01:05 bucefal91

If you're fixing a bug, you should add tests to validate your work.

fernando-ayon avatar May 12 '22 07:05 fernando-ayon