Blacklist image based subtitles from being included in the playlist manifest.

This commit is contained in:
Abdulmhsen B. A. A.
2024-08-10 22:38:50 +03:00
parent 2d9d465863
commit 8396b748bb
2 changed files with 7 additions and 3 deletions

View File

@@ -72,7 +72,7 @@ readonly class Playlist
foreach (findSideCarFiles(new SplFileInfo($path)) as $sideFile) {
$extension = getExtension($sideFile);
if (false === in_array($extension, self::ALLOWED_SUBS)) {
if (false === in_array($extension, array_keys(Subtitle::FORMATS))) {
continue;
}
@@ -164,6 +164,10 @@ readonly class Playlist
continue;
}
if (false === in_array(ag($x, 'codec_name'), Subtitle::INTERNAL_NAMING)) {
continue;
}
$lang = ag($x, 'tags.language', 'und');
$title = ag($x, 'tags.title', 'Unknown');

View File

@@ -20,14 +20,14 @@ use Throwable;
final readonly class Subtitle
{
private const array FORMATS = [
public const array FORMATS = [
'vtt' => 'text/vtt',
'webvtt' => 'text/vtt',
'srt' => 'text/srt',
'ass' => 'text/ass',
];
private const array INTERNAL_NAMING = [
public const array INTERNAL_NAMING = [
'subrip',
'ass',
'vtt'