fix(migrations): ignore invalid utf8 chars for media files metadata + update transcript parser

check that transcript parser constants are defined before declaring them
This commit is contained in:
Yassine Doghri 2022-01-28 10:31:30 +00:00
commit 45e8f99e75
4 changed files with 18 additions and 7 deletions

View file

@ -30,10 +30,21 @@ class TranscriptParser
*/
public function parseSrt(): string | false
{
define('SRT_STATE_SUBNUMBER', 0);
define('SRT_STATE_TIME', 1);
define('SRT_STATE_TEXT', 2);
define('SRT_STATE_BLANK', 3);
if (! defined('SRT_STATE_SUBNUMBER')) {
define('SRT_STATE_SUBNUMBER', 0);
}
if (! defined('SRT_STATE_TIME')) {
define('SRT_STATE_TIME', 1);
}
if (! defined('SRT_STATE_TEXT')) {
define('SRT_STATE_TEXT', 2);
}
if (! defined('SRT_STATE_BLANK')) {
define('SRT_STATE_BLANK', 3);
}
$subs = [];
$state = SRT_STATE_SUBNUMBER;