mirror of
https://code.castopod.org/adaures/castopod
synced 2025-06-05 17:02:01 +00:00
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:
parent
d807ab9732
commit
45e8f99e75
@ -88,7 +88,7 @@ class BaseMedia extends Entity
|
|||||||
|
|
||||||
$this->attributes['type'] = $this->type;
|
$this->attributes['type'] = $this->type;
|
||||||
$this->attributes['file_mimetype'] = $file->getMimeType();
|
$this->attributes['file_mimetype'] = $file->getMimeType();
|
||||||
$this->attributes['file_metadata'] = json_encode(lstat((string) $file));
|
$this->attributes['file_metadata'] = json_encode(lstat((string) $file), JSON_INVALID_UTF8_IGNORE);
|
||||||
$this->attributes['file_path'] = save_media(
|
$this->attributes['file_path'] = save_media(
|
||||||
$file,
|
$file,
|
||||||
$this->attributes['file_directory'],
|
$this->attributes['file_directory'],
|
||||||
|
@ -61,7 +61,7 @@ class Image extends BaseMedia
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->attributes['file_metadata'] = json_encode($metadata);
|
$this->attributes['file_metadata'] = json_encode($metadata, JSON_INVALID_UTF8_IGNORE);
|
||||||
|
|
||||||
$this->initFileProperties();
|
$this->initFileProperties();
|
||||||
$this->saveSizes();
|
$this->saveSizes();
|
||||||
|
@ -58,7 +58,7 @@ class Transcript extends BaseMedia
|
|||||||
$metadata['json_path'] = $jsonFilePath;
|
$metadata['json_path'] = $jsonFilePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->attributes['file_metadata'] = json_encode($metadata);
|
$this->attributes['file_metadata'] = json_encode($metadata, JSON_INVALID_UTF8_IGNORE);
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
@ -30,10 +30,21 @@ class TranscriptParser
|
|||||||
*/
|
*/
|
||||||
public function parseSrt(): string | false
|
public function parseSrt(): string | false
|
||||||
{
|
{
|
||||||
define('SRT_STATE_SUBNUMBER', 0);
|
if (! defined('SRT_STATE_SUBNUMBER')) {
|
||||||
define('SRT_STATE_TIME', 1);
|
define('SRT_STATE_SUBNUMBER', 0);
|
||||||
define('SRT_STATE_TEXT', 2);
|
}
|
||||||
define('SRT_STATE_BLANK', 3);
|
|
||||||
|
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 = [];
|
$subs = [];
|
||||||
$state = SRT_STATE_SUBNUMBER;
|
$state = SRT_STATE_SUBNUMBER;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user