Blacklist image based subtitles from being included in the playlist manifest.
This commit is contained in:
@@ -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');
|
||||||
|
|
||||||
|
|||||||
@@ -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'
|
||||||
|
|||||||
Reference in New Issue
Block a user