Skip to content

Commit f7a0748

Browse files
committed
Fix SubMicroDvd recognition
1 parent 20b84a5 commit f7a0748

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

src/Code/Converters/SubMicroDvdConverter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44

55
class SubMicroDvdConverter implements ConverterContract
66
{
7-
static protected $fps = 23.975; // SubtitleEdit by default uses this fps. Taken that value without much thinking. Change it to a better values if you will find.
7+
static protected $fps = 23.976; // SubtitleEdit by default uses this fps. Taken that value without much thinking. Change it to a better values if you will find.
88

99
public function canParseFileContent($file_content)
1010
{
11-
$pattern = "/\{\d+\}\{\d+\}(.*)\./";
11+
$pattern = "/\{\d+\}\{\d+\}(.*)/";
1212
return preg_match($pattern, $file_content, $matches);
1313
}
1414

tests/formats/SubMicroDvdTest.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,15 @@ public function testParsesStyles()
4242
$expected = $this->defaultSubtitles()->getInternalFormat();
4343
$this->assertInternalFormatsEqual($expected, $actual, 0.25);
4444
}
45+
46+
public function testParsesLinesWithoutDotAtTheEnd()
47+
{
48+
$content = <<<TEXT
49+
{0}{100}Subtitle line 1
50+
{150}{300}Subtitle line 2
51+
TEXT;
52+
$actual = Subtitles::loadFromString($content)->getInternalFormat();
53+
$expected = (new Subtitles())->add(0, 4.17, 'Subtitle line 1')->add(6.26, 12.51, 'Subtitle line 2')->getInternalFormat();
54+
$this->assertInternalFormatsEqual($expected, $actual);
55+
}
4556
}

0 commit comments

Comments
 (0)