Merge pull request #530 from arabcoders/dev

Ignore image based subtitles in playlist manifest.
This commit is contained in:
Abdulmohsen
2024-08-10 22:42:33 +03:00
committed by GitHub
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) { foreach (findSideCarFiles(new SplFileInfo($path)) as $sideFile) {
$extension = getExtension($sideFile); $extension = getExtension($sideFile);
if (false === in_array($extension, self::ALLOWED_SUBS)) { if (false === in_array($extension, array_keys(Subtitle::FORMATS))) {
continue; continue;
} }
@@ -164,6 +164,10 @@ readonly class Playlist
continue; continue;
} }
if (false === in_array(ag($x, 'codec_name'), Subtitle::INTERNAL_NAMING)) {
continue;
}
$lang = ag($x, 'tags.language', 'und'); $lang = ag($x, 'tags.language', 'und');
$title = ag($x, 'tags.title', 'Unknown'); $title = ag($x, 'tags.title', 'Unknown');

View File

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