blob: e539ca55bdf2652ba4f4657e65204cabfa4d9851 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
/*
* Copyright (C) 2023 Team Kodi
* This file is part of Kodi - https://kodi.tv
*
* SPDX-License-Identifier: GPL-2.0-or-later
* See LICENSES/README.md for more information.
*/
#include "PVRChannelGroupImageFileLoader.h"
#include "FileItem.h"
#include "filesystem/PVRGUIDirectory.h"
#include "guilib/Texture.h"
#include "pictures/Picture.h"
#include "pvr/PVRCachedImages.h"
#include "utils/log.h"
bool PVR::CPVRChannelGroupImageFileLoader::CanLoad(const std::string& specialType) const
{
return specialType == "pvr";
}
std::unique_ptr<CTexture> PVR::CPVRChannelGroupImageFileLoader::Load(const std::string& specialType,
const std::string& filePath,
unsigned int,
unsigned int) const
{
const CPVRGUIDirectory channelGroupDir(filePath);
CFileItemList channels;
if (!channelGroupDir.GetChannelsDirectory(channels))
{
return {};
}
std::vector<std::string> channelIcons;
for (const auto& channel : channels)
{
const std::string& icon = channel->GetArt("icon");
if (!icon.empty())
channelIcons.emplace_back(CPVRCachedImages::UnwrapImageURL(icon));
if (channelIcons.size() == 9) // limit number of tiles
break;
}
return CPicture::CreateTiledThumb(channelIcons);
}
|