Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[artist art] Musicvideo art is retrieved from the music database

  • Loading branch information...
commit 43bdd51e0f2bf7cc2c1440af1bd663f23c492eb4 1 parent 3c1178b
Jonathan Marshall authored
View
18 xbmc/ThumbLoader.cpp
@@ -299,6 +299,22 @@ bool CVideoThumbLoader::FillLibraryArt(CFileItem *pItem)
m_database->Open();
if (m_database->GetArtForItem(tag.m_iDbId, tag.m_type, artwork))
pItem->SetArt(artwork);
+ else if (pItem->GetVideoInfoTag()->m_type == "artist")
+ { // we retrieve music video art from the music database (no backward compat)
+ CMusicDatabase database;
+ database.Open();
+ int idArtist = database.GetArtistByName(pItem->GetLabel());
+ if (database.GetArtForItem(idArtist, "artist", artwork))
+ pItem->SetArt(artwork);
+ }
+ else if (pItem->GetVideoInfoTag()->m_type == "album")
+ { // we retrieve music video art from the music database (no backward compat)
+ CMusicDatabase database;
+ database.Open();
+ int idAlbum = database.GetAlbumByName(pItem->GetLabel(), pItem->GetVideoInfoTag()->m_artist);
+ if (database.GetArtForItem(idAlbum, "album", artwork))
+ pItem->SetArt(artwork);
+ }
else
{
if (tag.m_type == "movie" || tag.m_type == "episode" ||
@@ -325,7 +341,7 @@ bool CVideoThumbLoader::FillLibraryArt(CFileItem *pItem)
pItem->SetArt(items[0]->GetArt());
}
}
- else if (tag.m_type == "actor" || tag.m_type == "artist" ||
+ else if (tag.m_type == "actor" ||
tag.m_type == "writer" || tag.m_type == "director")
{
// We can't realistically get the local thumbs (as we'd need to check every movie that contains this actor)
View
11 xbmc/video/VideoDatabase.cpp
@@ -50,7 +50,6 @@
#include "addons/AddonInstaller.h"
#include "interfaces/AnnouncementManager.h"
#include "dbwrappers/dataset.h"
-#include "ThumbnailCache.h"
#include "utils/LabelFormatter.h"
#include "XBDateTime.h"
@@ -4499,9 +4498,6 @@ bool CVideoDatabase::GetMusicVideoAlbumsNav(const CStdString& strBaseDir, CFileI
if (!items.Contains(pItem->GetPath()))
{
pItem->GetVideoInfoTag()->m_artist.push_back(it->second.second);
- CStdString strThumb = CThumbnailCache::GetAlbumThumb(*pItem);
- if (CFile::Exists(strThumb))
- pItem->SetThumbnailImage(strThumb);
items.Add(pItem);
}
}
@@ -4522,9 +4518,6 @@ bool CVideoDatabase::GetMusicVideoAlbumsNav(const CStdString& strBaseDir, CFileI
if (!items.Contains(pItem->GetPath()))
{
pItem->GetVideoInfoTag()->m_artist.push_back(m_pDS->fv(2).get_asString());
- CStdString strThumb = CThumbnailCache::GetAlbumThumb(pItem->GetLabel(), m_pDS->fv(2).get_asString());
- if (CFile::Exists(strThumb))
- pItem->SetThumbnailImage(strThumb);
items.Add(pItem);
}
}
@@ -4561,11 +4554,7 @@ bool CVideoDatabase::GetActorsNav(const CStdString& strBaseDir, CFileItemList& i
{
CFileItemPtr pItem = items[i];
if (idContent == VIDEODB_CONTENT_MUSICVIDEOS)
- {
- if (CFile::Exists(pItem->GetCachedArtistThumb()))
- pItem->SetThumbnailImage(pItem->GetCachedArtistThumb());
pItem->SetIconImage("DefaultArtist.png");
- }
else
pItem->SetIconImage("DefaultActor.png");
}
View
9 xbmc/video/dialogs/GUIDialogVideoInfo.cpp
@@ -46,6 +46,7 @@
#include "guilib/LocalizeStrings.h"
#include "GUIUserMessages.h"
#include "TextureCache.h"
+#include "music/MusicDatabase.h"
using namespace std;
using namespace XFILE;
@@ -233,12 +234,16 @@ void CGUIDialogVideoInfo::SetMovie(const CFileItem *item)
VIDEODB_CONTENT_TYPE type = (VIDEODB_CONTENT_TYPE)m_movieItem->GetVideoContentType();
if (type == VIDEODB_CONTENT_MUSICVIDEOS)
{ // music video
+ CMusicDatabase database;
+ database.Open();
const std::vector<std::string> &artists = m_movieItem->GetVideoInfoTag()->m_artist;
for (std::vector<std::string>::const_iterator it = artists.begin(); it != artists.end(); ++it)
{
+ int idArtist = database.GetArtistByName(*it);
+ CStdString thumb = database.GetArtForItem(idArtist, "artist", "thumb");
CFileItemPtr item(new CFileItem(*it));
- if (CFile::Exists(item->GetCachedArtistThumb()))
- item->SetThumbnailImage(item->GetCachedArtistThumb());
+ if (!thumb.empty())
+ item->SetThumbnailImage(thumb);
item->SetIconImage("DefaultArtist.png");
m_castList->Add(item);
}
View
59 xbmc/video/windows/GUIWindowVideoNav.cpp
@@ -775,13 +775,6 @@ bool CGUIWindowVideoNav::DeleteItem(CFileItem* pItem, bool bUnavailable /* = fal
void CGUIWindowVideoNav::OnPrepareFileItems(CFileItemList &items)
{
CGUIWindowVideoBase::OnPrepareFileItems(items);
-
- // set fanart
- CQueryParams params;
- CVideoDatabaseDirectory dir;
- dir.GetQueryParams(items.GetPath(),params);
- if (params.GetContentType() == VIDEODB_CONTENT_MUSICVIDEOS)
- CGUIWindowMusicNav::SetupFanart(items);
}
void CGUIWindowVideoNav::GetContextButtons(int itemNumber, CContextButtons &buttons)
@@ -1026,22 +1019,25 @@ bool CGUIWindowVideoNav::OnContextButton(int itemNumber, CONTEXT_BUTTON button)
case CONTEXT_BUTTON_SET_MOVIESET_THUMB:
{
// Grab the thumbnails from the web
- CStdString strPath;
CFileItemList items;
- URIUtils::AddFileToFolder(g_advancedSettings.m_cachePath,"imdbthumbs",strPath);
- CFileItemPtr cacheItem(new CFileItem(strPath,true));
- CFileUtils::DeleteItem(cacheItem,true);
- XFILE::CDirectory::Create(strPath);
CFileItemPtr noneitem(new CFileItem("thumb://None", false));
- CStdString cachedThumb;
+ CStdString currentThumb;
+ int idArtist = -1;
+ CStdString artistPath;
if (button == CONTEXT_BUTTON_SET_ARTIST_THUMB)
- cachedThumb = m_vecItems->Get(itemNumber)->GetCachedArtistThumb();
- else
- cachedThumb = m_database.GetArtForItem(m_vecItems->Get(itemNumber)->GetVideoInfoTag()->m_iDbId, m_vecItems->Get(itemNumber)->GetVideoInfoTag()->m_type, "thumb");
- if (!cachedThumb.IsEmpty() && CFile::Exists(cachedThumb))
+ {
+ CMusicDatabase database;
+ database.Open();
+ idArtist = database.GetArtistByName(m_vecItems->Get(itemNumber)->GetLabel());
+ database.GetArtistPath(idArtist, artistPath);
+ currentThumb = database.GetArtForItem(idArtist, "artist", "thumb");
+ }
+ if (currentThumb.empty())
+ currentThumb = m_database.GetArtForItem(m_vecItems->Get(itemNumber)->GetVideoInfoTag()->m_iDbId, m_vecItems->Get(itemNumber)->GetVideoInfoTag()->m_type, "thumb");
+ if (!currentThumb.IsEmpty() && CFile::Exists(currentThumb))
{
CFileItemPtr item(new CFileItem("thumb://Current", false));
- item->SetThumbnailImage(cachedThumb);
+ item->SetThumbnailImage(currentThumb);
item->SetLabel(g_localizeStrings.Get(20016));
items.Add(item);
}
@@ -1079,24 +1075,8 @@ bool CGUIWindowVideoNav::OnContextButton(int itemNumber, CONTEXT_BUTTON button)
bool local=false;
if (button == CONTEXT_BUTTON_SET_ARTIST_THUMB)
{
- CStdString picturePath;
-
- CStdString strPath = m_vecItems->Get(itemNumber)->GetPath();
- URIUtils::RemoveSlashAtEnd(strPath);
-
- int nPos=strPath.ReverseFind("/");
- if (nPos>-1)
- {
- // try to guess where the user should start
- // browsing for the artist thumb
- CMusicDatabase database;
- database.Open();
- long idArtist=database.GetArtistByName(m_vecItems->Get(itemNumber)->GetLabel());
- database.GetArtistPath(idArtist, picturePath);
- }
-
CStdString strThumb;
- URIUtils::AddFileToFolder(picturePath,"folder.jpg",strThumb);
+ URIUtils::AddFileToFolder(artistPath,"folder.jpg",strThumb);
if (XFILE::CFile::Exists(strThumb))
{
CFileItemPtr pItem(new CFileItem(strThumb,false));
@@ -1155,13 +1135,14 @@ bool CGUIWindowVideoNav::OnContextButton(int itemNumber, CONTEXT_BUTTON button)
result.clear();
if (button == CONTEXT_BUTTON_SET_MOVIESET_THUMB ||
button == CONTEXT_BUTTON_SET_ACTOR_THUMB ||
- button == CONTEXT_BUTTON_SET_SEASON_THUMB)
+ button == CONTEXT_BUTTON_SET_SEASON_THUMB ||
+ (button == CONTEXT_BUTTON_SET_ARTIST_THUMB && idArtist < 0))
m_database.SetArtForItem(m_vecItems->Get(itemNumber)->GetVideoInfoTag()->m_iDbId, m_vecItems->Get(itemNumber)->GetVideoInfoTag()->m_type, "thumb", result);
else
{
- CTextureCache::Get().ClearCachedImage(cachedThumb, true);
- if (!result.IsEmpty())
- CFile::Cache(result,cachedThumb);
+ CMusicDatabase db;
+ if (db.Open())
+ db.SetArtForItem(idArtist, "artist", "thumb", result);
}
CUtil::DeleteVideoDatabaseDirectoryCache();
Please sign in to comment.
Something went wrong with that request. Please try again.