mirror of https://github.com/xbmc/xbmc
Merge pull request #27316 from damienruscoe/video_thumb_loader_database_interaction
[VideoThumbLoader] Refactor
This commit is contained in:
commit
acb75e8519
|
|
@ -2743,41 +2743,6 @@ std::string CVideoDatabase::GetValueString(const CVideoInfoTag& details,
|
||||||
}
|
}
|
||||||
|
|
||||||
//********************************************************************************************************************************
|
//********************************************************************************************************************************
|
||||||
int CVideoDatabase::SetDetailsForItem(CVideoInfoTag& details, const KODI::ART::Artwork& artwork)
|
|
||||||
{
|
|
||||||
return SetDetailsForItem(details.m_iDbId, details.m_type, details, artwork);
|
|
||||||
}
|
|
||||||
|
|
||||||
int CVideoDatabase::SetDetailsForItem(int id,
|
|
||||||
MediaType_view mediaType,
|
|
||||||
CVideoInfoTag& details,
|
|
||||||
const KODI::ART::Artwork& artwork)
|
|
||||||
{
|
|
||||||
if (mediaType == MediaTypeNone)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
if (mediaType == MediaTypeMovie)
|
|
||||||
return SetDetailsForMovie(details, artwork, id);
|
|
||||||
else if (mediaType == MediaTypeVideoCollection)
|
|
||||||
return SetDetailsForMovieSet(details, artwork, id);
|
|
||||||
else if (mediaType == MediaTypeTvShow)
|
|
||||||
{
|
|
||||||
KODI::ART::SeasonsArtwork seasonArtwork;
|
|
||||||
if (!UpdateDetailsForTvShow(id, details, artwork, seasonArtwork))
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
else if (mediaType == MediaTypeSeason)
|
|
||||||
return SetDetailsForSeason(details, artwork, details.m_iIdShow, id);
|
|
||||||
else if (mediaType == MediaTypeEpisode)
|
|
||||||
return SetDetailsForEpisode(details, artwork, details.m_iIdShow, id);
|
|
||||||
else if (mediaType == MediaTypeMusicVideo)
|
|
||||||
return SetDetailsForMusicVideo(details, artwork, id);
|
|
||||||
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int CVideoDatabase::SetDetailsForMovie(CVideoInfoTag& details,
|
int CVideoDatabase::SetDetailsForMovie(CVideoInfoTag& details,
|
||||||
const KODI::ART::Artwork& artwork,
|
const KODI::ART::Artwork& artwork,
|
||||||
int idMovie /* = -1 */)
|
int idMovie /* = -1 */)
|
||||||
|
|
|
||||||
|
|
@ -688,12 +688,6 @@ public:
|
||||||
dbiplus::Dataset& pDS,
|
dbiplus::Dataset& pDS,
|
||||||
int idFile = -1 /* = -1 */) const;
|
int idFile = -1 /* = -1 */) const;
|
||||||
|
|
||||||
int SetDetailsForItem(CVideoInfoTag& details, const KODI::ART::Artwork& artwork);
|
|
||||||
int SetDetailsForItem(int id,
|
|
||||||
MediaType_view mediaType,
|
|
||||||
CVideoInfoTag& details,
|
|
||||||
const KODI::ART::Artwork& artwork);
|
|
||||||
|
|
||||||
int SetDetailsForMovie(CVideoInfoTag& details,
|
int SetDetailsForMovie(CVideoInfoTag& details,
|
||||||
const KODI::ART::Artwork& artwork,
|
const KODI::ART::Artwork& artwork,
|
||||||
int idMovie = -1);
|
int idMovie = -1);
|
||||||
|
|
|
||||||
|
|
@ -340,7 +340,7 @@ bool CVideoThumbLoader::LoadItemLookup(CFileItem* pItem)
|
||||||
info->SetDuration(info->GetDuration());
|
info->SetDuration(info->GetDuration());
|
||||||
|
|
||||||
// store the updated information in the database
|
// store the updated information in the database
|
||||||
m_videoDatabase->SetDetailsForItem(info->m_iDbId, info->m_type, *info, pItem->GetArt());
|
SetDetailsForItem(*info, pItem->GetArt());
|
||||||
}
|
}
|
||||||
|
|
||||||
m_videoDatabase->CommitTransaction();
|
m_videoDatabase->CommitTransaction();
|
||||||
|
|
@ -353,6 +353,36 @@ bool CVideoThumbLoader::LoadItemLookup(CFileItem* pItem)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int CVideoThumbLoader::SetDetailsForItem(CVideoInfoTag& details, const KODI::ART::Artwork& artwork)
|
||||||
|
{
|
||||||
|
int id = details.m_iDbId;
|
||||||
|
MediaType_view mediaType = details.m_type;
|
||||||
|
|
||||||
|
if (mediaType == MediaTypeNone)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if (mediaType == MediaTypeMovie)
|
||||||
|
return m_videoDatabase->SetDetailsForMovie(details, artwork, id);
|
||||||
|
else if (mediaType == MediaTypeVideoCollection)
|
||||||
|
return m_videoDatabase->SetDetailsForMovieSet(details, artwork, id);
|
||||||
|
else if (mediaType == MediaTypeTvShow)
|
||||||
|
{
|
||||||
|
KODI::ART::SeasonsArtwork seasonArtwork;
|
||||||
|
if (!m_videoDatabase->UpdateDetailsForTvShow(id, details, artwork, seasonArtwork))
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
else if (mediaType == MediaTypeSeason)
|
||||||
|
return m_videoDatabase->SetDetailsForSeason(details, artwork, details.m_iIdShow, id);
|
||||||
|
else if (mediaType == MediaTypeEpisode)
|
||||||
|
return m_videoDatabase->SetDetailsForEpisode(details, artwork, details.m_iIdShow, id);
|
||||||
|
else if (mediaType == MediaTypeMusicVideo)
|
||||||
|
return m_videoDatabase->SetDetailsForMusicVideo(details, artwork, id);
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
bool CVideoThumbLoader::FillLibraryArt(CFileItem &item)
|
bool CVideoThumbLoader::FillLibraryArt(CFileItem &item)
|
||||||
{
|
{
|
||||||
CVideoInfoTag &tag = *item.GetVideoInfoTag();
|
CVideoInfoTag &tag = *item.GetVideoInfoTag();
|
||||||
|
|
|
||||||
|
|
@ -84,4 +84,7 @@ protected:
|
||||||
void DetectAndAddMissingItemData(CFileItem &item);
|
void DetectAndAddMissingItemData(CFileItem &item);
|
||||||
|
|
||||||
const KODI::ART::Artwork& GetArtFromCache(const std::string& mediaType, const int id);
|
const KODI::ART::Artwork& GetArtFromCache(const std::string& mediaType, const int id);
|
||||||
|
|
||||||
|
private:
|
||||||
|
int SetDetailsForItem(CVideoInfoTag& details, const KODI::ART::Artwork& artwork);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue