2 * Copyright (C) 2023 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
9 #include "PVRChannelGroupImageFileLoader.h"
12 #include "FileItemList.h"
13 #include "filesystem/PVRGUIDirectory.h"
14 #include "guilib/Texture.h"
15 #include "pictures/Picture.h"
16 #include "pvr/PVRCachedImages.h"
17 #include "utils/log.h"
19 bool PVR::CPVRChannelGroupImageFileLoader::CanLoad(const std::string
& specialType
) const
21 return specialType
== "pvr";
24 std::unique_ptr
<CTexture
> PVR::CPVRChannelGroupImageFileLoader::Load(const std::string
& specialType
,
25 const std::string
& filePath
,
29 const CPVRGUIDirectory
channelGroupDir(filePath
);
30 CFileItemList channels
;
31 if (!channelGroupDir
.GetChannelsDirectory(channels
))
36 std::vector
<std::string
> channelIcons
;
37 for (const auto& channel
: channels
)
39 const std::string
& icon
= channel
->GetArt("icon");
41 channelIcons
.emplace_back(CPVRCachedImages::UnwrapImageURL(icon
));
43 if (channelIcons
.size() == 9) // limit number of tiles
47 return CPicture::CreateTiledThumb(channelIcons
);