Обход ограничения http/https при загрузке логотипов каналов + их ленивое кэширование

This commit is contained in:
2024-09-25 01:13:39 +08:00
parent d097366605
commit 2f0186e49f
11 changed files with 230 additions and 6 deletions

View File

@@ -204,6 +204,16 @@ class Playlist
if ($isChannel) {
$channel['url'] = str_starts_with($line, 'http') ? $line : null;
$logoUrl = $channel['attributes']['tvg-logo'] ?? null;
if (is_string($logoUrl)) {
$logo = new ChannelLogo($logoUrl);
$logo->readFile();
$channel['logo'] = [
'base64' => $logo->asBase64(),
'size' => $logo->size(),
'mime-type' => $logo->mimeType(),
];
}
$result['channels'][] = $channel;
$isChannel = false;
unset($channel);