2 * Copyright (C) 2012-2018 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.
12 #include "ThumbLoader.h"
21 using ArtMap
= std::map
<std::string
, std::string
>;
22 using ArtCache
= std::map
<std::pair
<MediaType
, int>, ArtMap
>;
24 class CVideoThumbLoader
: public CThumbLoader
28 ~CVideoThumbLoader() override
;
30 void OnLoaderStart() override
;
31 void OnLoaderFinish() override
;
33 bool LoadItem(CFileItem
* pItem
) override
;
34 bool LoadItemCached(CFileItem
* pItem
) override
;
35 bool LoadItemLookup(CFileItem
* pItem
) override
;
37 /*! \brief Fill the thumb of a video item
38 First uses a cached thumb from a previous run, then checks for a local thumb
39 and caches it for the next run
40 \param item the CFileItem object to fill
41 \return true if we fill the thumb, false otherwise
43 virtual bool FillThumb(CFileItem
&item
);
45 /*! \brief Find a particular art type for a given item, optionally checking at the folder level
46 \param item the CFileItem to search.
47 \param type the type of art to look for.
48 \param checkFolder whether to also check the folder level for files. Defaults to false.
49 \return the art file (if found), else empty.
51 static std::string
GetLocalArt(const CFileItem
&item
, const std::string
&type
, bool checkFolder
= false);
53 /*! \brief return the available art types for a given media type
54 \param type the type of media.
55 \return a vector of art types.
58 static std::vector
<std::string
> GetArtTypes(const std::string
&type
);
60 static bool IsValidArtType(const std::string
& potentialArtType
);
62 static bool IsArtTypeInWhitelist(const std::string
& artType
, const std::vector
<std::string
>& whitelist
, bool exact
);
64 /*! \brief helper function to retrieve a thumb URL for embedded video thumbs
65 \param item a video CFileItem.
66 \return a URL for the embedded thumb.
68 static std::string
GetEmbeddedThumbURL(const CFileItem
&item
);
70 /*! \brief helper function to fill the art for a video library item
71 \param item a video CFileItem
72 \return true if we fill art, false otherwise
74 bool FillLibraryArt(CFileItem
&item
) override
;
77 CVideoDatabase
*m_videoDatabase
;
80 /*! \brief Tries to detect missing data/info from a file and adds those
81 \param item The CFileItem to process
84 void DetectAndAddMissingItemData(CFileItem
&item
);
86 const ArtMap
& GetArtFromCache(const std::string
&mediaType
, const int id
);