1 /* 2 * Copyright (C) 2012-2018 Team Kodi 3 * This file is part of Kodi - https://kodi.tv 4 * 5 * SPDX-License-Identifier: GPL-2.0-or-later 6 * See LICENSES/README.md for more information. 7 */ 8 9 #pragma once 10 11 #include "ThumbLoader.h" 12 13 #include <map> 14 15 class CFileItem; 16 class CMusicDatabase; 17 class EmbeddedArt; 18 19 class CMusicThumbLoader : public CThumbLoader 20 { 21 public: 22 CMusicThumbLoader(); 23 ~CMusicThumbLoader() override; 24 25 void OnLoaderStart() override; 26 void OnLoaderFinish() override; 27 28 bool LoadItem(CFileItem* pItem) override; 29 bool LoadItemCached(CFileItem* pItem) override; 30 bool LoadItemLookup(CFileItem* pItem) override; 31 32 /*! \brief Helper function to fill all the art for a music library item 33 This fetches the original url for each type of art, and sets fallback thumb and fanart. 34 For songs the art for the related album and artist(s) is also set, and for albums that 35 of the related artist(s). Art type is named according to media type of the item, 36 for example: 37 artists may have "thumb", "fanart", "logo", "poster" etc., 38 albums may have "thumb", "spine" etc. and "artist.thumb", "artist.fanart" etc., 39 songs may have "thumb", "album.thumb", "artist.thumb", "artist.fanart", "artist.logo",... 40 "artist1.thumb", "artist1.fanart",... "albumartist.thumb", "albumartist1.thumb" etc. 41 \param item a music CFileItem 42 \return true if we fill art, false if there is no art found 43 */ 44 bool FillLibraryArt(CFileItem &item) override; 45 46 /*! \brief Fill the thumb of a music file/folder item 47 First uses a cached thumb from a previous run, then checks for a local thumb 48 and caches it for the next run 49 \param item the CFileItem object to fill 50 \return true if we fill the thumb, false otherwise 51 */ 52 virtual bool FillThumb(CFileItem &item, bool folderThumbs = true); 53 54 static bool GetEmbeddedThumb(const std::string &path, EmbeddedArt &art); 55 56 protected: 57 CMusicDatabase *m_musicDatabase; 58 typedef std::map<int, std::map<std::string, std::string> > ArtCache; 59 ArtCache m_albumArt; 60 }; 61