return false;
}
-CStdString CFileItem::GetUserMusicThumb(bool alwaysCheckRemote /* = false */) const
+CStdString CFileItem::GetUserMusicThumb(bool alwaysCheckRemote /* = false */, bool fallbackToFolder /* = false */) const
{
if (m_strPath.IsEmpty()
|| m_bIsShareOrDrive
if (CFile::Exists(fileThumb))
return fileThumb;
+ // Fall back to folder thumb, if requested
+ if (!m_bIsFolder && fallbackToFolder)
+ {
+ CFileItem item(URIUtils::GetDirectory(m_strPath), true);
+ return item.GetUserMusicThumb(alwaysCheckRemote);
+ }
+
// if a folder, check for folder.jpg
if (m_bIsFolder && !IsFileFolder() && (!IsRemote() || alwaysCheckRemote || g_guiSettings.GetBool("musicfiles.findremotethumbs")))
{
CStdString GetBaseMoviePath(bool useFolderNames) const;
// Gets the user thumb, if it exists
- CStdString GetUserMusicThumb(bool alwaysCheckRemote = false) const;
+ CStdString GetUserMusicThumb(bool alwaysCheckRemote = false, bool fallbackToFolder = false) const;
/*! \brief Get the path where we expect local metadata to reside.
For a folder, this is just the existing path (eg tvshow folder)
if (pItem->m_bIsFolder || pItem->IsPlayList() || pItem->IsNFO() || pItem->IsInternetStream())
return false;
- // Get thumb for item
- if (m_thumbLoader)
- m_thumbLoader->LoadItem(pItem);
-
- if (pItem->HasMusicInfoTag() && pItem->GetMusicInfoTag()->Loaded())
- return true;
-
+ if (!pItem->HasMusicInfoTag() || !pItem->GetMusicInfoTag()->Loaded())
+ {
// first check the cached item
CFileItemPtr mapItem = (*m_mapFileItems)[pItem->GetPath()];
if (mapItem && mapItem->m_dateTime==pItem->m_dateTime && mapItem->HasMusicInfoTag() && mapItem->GetMusicInfoTag()->Loaded())
{ // Query map if we previously cached the file on HD
*pItem->GetMusicInfoTag() = *mapItem->GetMusicInfoTag();
pItem->SetArt("thumb", mapItem->GetArt("thumb"));
- return true;
}
-
+ else
+ {
CStdString strPath;
URIUtils::GetDirectory(pItem->GetPath(), strPath);
URIUtils::AddSlashAtEnd(strPath);
}
m_strPrevPath = strPath;
+ }
+ }
+
+ // Get thumb for item
+ m_thumbLoader->LoadItem(pItem);
+
return true;
}
CStdString thumb = GetCachedImage(item, "thumb");
if (thumb.IsEmpty())
{
- thumb = item.GetUserMusicThumb();
+ thumb = item.GetUserMusicThumb(false, true);
if (!thumb.IsEmpty())
SetCachedImage(item, "thumb", thumb);
}