diff --git a/src/Code/Converters/StlConverter.php b/src/Code/Converters/StlConverter.php index 70cd895..dd5c2f6 100644 --- a/src/Code/Converters/StlConverter.php +++ b/src/Code/Converters/StlConverter.php @@ -6,7 +6,7 @@ class StlConverter implements ConverterContract { public function canParseFileContent($file_content) { - return preg_match('/^\d{2}:\d{2}:\d{2}:\d{2} , \d{2}:\d{2}:\d{2}:\d{2} , .+/m', $file_content) === 1; + return preg_match('/^\d{2}:\d{2}:\d{2}:\d{2}\s,\s\d{2}:\d{2}:\d{2}:\d{2}\s,.+/m', $file_content) === 1; } public function fileContentToInternalFormat($file_content, $original_file_content) diff --git a/tests/formats/StlTest.php b/tests/formats/StlTest.php index 7c7ef63..f3c7489 100644 --- a/tests/formats/StlTest.php +++ b/tests/formats/StlTest.php @@ -93,4 +93,19 @@ public function testTimesBiggerThan99HoursThrowException() $subtitles->content('stl'); } + public function testClientFile() + { + $text = ' +$FadeOut = 0 +$TapeOffset = TRUE + +$HorzAlign = Center +'."00:00:00:00\t,\t00:00:01:00\t,\ta +00:00:01:00\t,\t00:00:02:00\t,\tb +"; + + $actual = Subtitles::loadFromString($text)->getInternalFormat(); + $expected = (new Subtitles())->add(0, 1, 'a')->add(1, 2, 'b')->getInternalFormat(); + $this->assertInternalFormatsEqual($expected, $actual); + } } \ No newline at end of file