Permalink
Browse files

no need to DeleteThumbForItem() in the videodatabase - the texturecac…

…he knows about them
  • Loading branch information...
1 parent 51257ea commit 61f11292029ff8d47505e4b02f4d9e43783ef038 Jonathan Marshall committed May 7, 2012
Showing with 27 additions and 71 deletions.
  1. +18 −61 xbmc/video/VideoDatabase.cpp
  2. +9 −10 xbmc/video/VideoDatabase.h
@@ -1512,7 +1512,7 @@ bool CVideoDatabase::HasMusicVideoInfo(const CStdString& strFilenameAndPath)
return false;
}
-void CVideoDatabase::DeleteDetailsForTvShow(const CStdString& strPath, bool bKeepThumb /* = false */, int idTvShow /* = -1 */)
+void CVideoDatabase::DeleteDetailsForTvShow(const CStdString& strPath, int idTvShow /* = -1 */)
{
try
{
@@ -1526,17 +1526,6 @@ void CVideoDatabase::DeleteDetailsForTvShow(const CStdString& strPath, bool bKee
return;
}
- if (!bKeepThumb)
- {
- CFileItemList items;
- CStdString strPath2;
- strPath2.Format("videodb://2/2/%i/", idTvShow);
- GetSeasonsNav(strPath2, items, -1, -1, -1, -1, idTvShow);
- for (int i = 0; i < items.Size(); ++i)
- CTextureCache::Get().ClearCachedImage(items[i]->GetCachedSeasonThumb(), true);
- DeleteThumbForItem(strPath, true);
- }
-
CStdString strSQL;
strSQL=PrepareSQL("delete from genrelinktvshow where idShow=%i", idTvShow);
m_pDS->exec(strSQL.c_str());
@@ -1812,7 +1801,7 @@ int CVideoDatabase::SetDetailsForMovie(const CStdString& strFilenameAndPath, con
idMovie = GetMovieId(strFilenameAndPath);
if (idMovie > -1)
- DeleteMovie(strFilenameAndPath, true, true, idMovie); // true to keep the table entry and the thumb
+ DeleteMovie(strFilenameAndPath, true, idMovie); // true to keep the table entry
else
{
// only add a new movie if we don't already have a valid idMovie
@@ -1904,7 +1893,7 @@ int CVideoDatabase::SetDetailsForTvShow(const CStdString& strPath, const CVideoI
idTvShow = GetTvShowId(strPath);
if (idTvShow > -1)
- DeleteDetailsForTvShow(strPath, true, idTvShow);
+ DeleteDetailsForTvShow(strPath, idTvShow);
else
{
idTvShow = AddTvShow(strPath);
@@ -1975,7 +1964,7 @@ int CVideoDatabase::SetDetailsForEpisode(const CStdString& strFilenameAndPath, c
idEpisode = GetEpisodeId(strFilenameAndPath);
if (idEpisode > 0)
- DeleteEpisode(strFilenameAndPath, idEpisode, true, true); // true to keep the table entry and the thumb
+ DeleteEpisode(strFilenameAndPath, idEpisode, true); // true to keep the table entry
else
{
// only add a new episode if we don't already have a valid idEpisode
@@ -2069,7 +2058,7 @@ int CVideoDatabase::SetDetailsForMusicVideo(const CStdString& strFilenameAndPath
idMVideo = GetMusicVideoId(strFilenameAndPath);
if (idMVideo > -1)
- DeleteMusicVideo(strFilenameAndPath, true, true, idMVideo); // Keep id and thumb
+ DeleteMusicVideo(strFilenameAndPath, true, idMVideo); // Keep id
else
{
// only add a new musicvideo if we don't already have a valid idMVideo
@@ -2499,18 +2488,18 @@ void CVideoDatabase::DeleteBookMarkForEpisode(const CVideoInfoTag& tag)
}
//********************************************************************************************************************************
-void CVideoDatabase::DeleteMovie(int idMovie, bool bKeepId /* = false */, bool bKeepThumb /* = false */)
+void CVideoDatabase::DeleteMovie(int idMovie, bool bKeepId /* = false */)
{
if (idMovie < 0)
return;
CStdString path;
GetFilePathById(idMovie, path, VIDEODB_CONTENT_MOVIES);
if (!path.empty())
- DeleteMovie(path, bKeepId, bKeepThumb, idMovie);
+ DeleteMovie(path, bKeepId, idMovie);
}
-void CVideoDatabase::DeleteMovie(const CStdString& strFilenameAndPath, bool bKeepId /* = false */, bool bKeepThumb /* = false */, int idMovie /* = -1 */)
+void CVideoDatabase::DeleteMovie(const CStdString& strFilenameAndPath, bool bKeepId /* = false */, int idMovie /* = -1 */)
{
try
{
@@ -2544,9 +2533,6 @@ void CVideoDatabase::DeleteMovie(const CStdString& strFilenameAndPath, bool bKee
strSQL=PrepareSQL("delete from countrylinkmovie where idMovie=%i", idMovie);
m_pDS->exec(strSQL.c_str());
- if (!bKeepThumb)
- DeleteThumbForItem(strFilenameAndPath,false);
-
DeleteStreamDetails(GetFileId(strFilenameAndPath));
// keep the movie table entry, linking to tv shows, and bookmarks
@@ -2577,18 +2563,18 @@ void CVideoDatabase::DeleteMovie(const CStdString& strFilenameAndPath, bool bKee
}
}
-void CVideoDatabase::DeleteTvShow(int idTvShow, bool bKeepId /* = false */, bool bKeepThumb /* = false */)
+void CVideoDatabase::DeleteTvShow(int idTvShow, bool bKeepId /* = false */)
{
if (idTvShow < 0)
return;
CStdString path;
GetFilePathById(idTvShow, path, VIDEODB_CONTENT_TVSHOWS);
if (!path.empty())
- DeleteTvShow(path, bKeepId, bKeepThumb, idTvShow);
+ DeleteTvShow(path, bKeepId, idTvShow);
}
-void CVideoDatabase::DeleteTvShow(const CStdString& strPath, bool bKeepId /* = false */, bool bKeepThumb /* = false */, int idTvShow /* = -1 */)
+void CVideoDatabase::DeleteTvShow(const CStdString& strPath, bool bKeepId /* = false */, int idTvShow /* = -1 */)
{
try
{
@@ -2615,7 +2601,7 @@ void CVideoDatabase::DeleteTvShow(const CStdString& strPath, bool bKeepId /* = f
m_pDS2->next();
}
- DeleteDetailsForTvShow(strPath, bKeepThumb, idTvShow);
+ DeleteDetailsForTvShow(strPath, idTvShow);
strSQL=PrepareSQL("delete from seasons where idShow=%i", idTvShow);
m_pDS->exec(strSQL.c_str());
@@ -2646,18 +2632,18 @@ void CVideoDatabase::DeleteTvShow(const CStdString& strPath, bool bKeepId /* = f
}
}
-void CVideoDatabase::DeleteEpisode(int idEpisode, bool bKeepId /* = false */, bool bKeepThumb /* = false */)
+void CVideoDatabase::DeleteEpisode(int idEpisode, bool bKeepId /* = false */)
{
if (idEpisode < 0)
return;
CStdString path;
GetFilePathById(idEpisode, path, VIDEODB_CONTENT_EPISODES);
if (!path.empty())
- DeleteEpisode(path, idEpisode, bKeepId, bKeepThumb);
+ DeleteEpisode(path, idEpisode, bKeepId);
}
-void CVideoDatabase::DeleteEpisode(const CStdString& strFilenameAndPath, int idEpisode /* = -1 */, bool bKeepId /* = false */, bool bKeepThumb /* = false */)
+void CVideoDatabase::DeleteEpisode(const CStdString& strFilenameAndPath, int idEpisode /* = -1 */, bool bKeepId /* = false */)
{
try
{
@@ -2682,9 +2668,6 @@ void CVideoDatabase::DeleteEpisode(const CStdString& strFilenameAndPath, int idE
strSQL=PrepareSQL("delete from writerlinkepisode where idEpisode=%i", idEpisode);
m_pDS->exec(strSQL.c_str());
- if (!bKeepThumb)
- DeleteThumbForItem(strFilenameAndPath, false, idEpisode);
-
DeleteStreamDetails(GetFileId(strFilenameAndPath));
// keep episode table entry and bookmarks so we can update the data in place
@@ -2709,18 +2692,18 @@ void CVideoDatabase::DeleteEpisode(const CStdString& strFilenameAndPath, int idE
}
}
-void CVideoDatabase::DeleteMusicVideo(int idMusicVideo, bool bKeepId /* = false */, bool bKeepThumb /* = false */)
+void CVideoDatabase::DeleteMusicVideo(int idMusicVideo, bool bKeepId /* = false */)
{
if (idMusicVideo < 0)
return;
CStdString path;
GetFilePathById(idMusicVideo, path, VIDEODB_CONTENT_MUSICVIDEOS);
if (!path.empty())
- DeleteMusicVideo(path, bKeepId, bKeepThumb, idMusicVideo);
+ DeleteMusicVideo(path, bKeepId, idMusicVideo);
}
-void CVideoDatabase::DeleteMusicVideo(const CStdString& strFilenameAndPath, bool bKeepId /* = false */, bool bKeepThumb /* = false */, int idMVideo /* = -1 */)
+void CVideoDatabase::DeleteMusicVideo(const CStdString& strFilenameAndPath, bool bKeepId /* = false */, int idMVideo /* = -1 */)
{
try
{
@@ -2748,9 +2731,6 @@ void CVideoDatabase::DeleteMusicVideo(const CStdString& strFilenameAndPath, bool
strSQL=PrepareSQL("delete from studiolinkmusicvideo where idMVideo=%i", idMVideo);
m_pDS->exec(strSQL.c_str());
- if (!bKeepThumb)
- DeleteThumbForItem(strFilenameAndPath,false);
-
DeleteStreamDetails(GetFileId(strFilenameAndPath));
// keep the music video table entry and bookmarks so we can update data in place
@@ -8034,29 +8014,6 @@ bool CVideoDatabase::CommitTransaction()
return false;
}
-void CVideoDatabase::DeleteThumbForItem(const CStdString& strPath, bool bFolder, int idEpisode)
-{
- CFileItem item(strPath,bFolder);
- if (idEpisode > 0)
- {
- item.SetPath(item.GetVideoInfoTag()->m_strFileNameAndPath);
- if (CFile::Exists(item.GetCachedEpisodeThumb()))
- CTextureCache::Get().ClearCachedImage(item.GetCachedEpisodeThumb(), true);
- else
- CTextureCache::Get().ClearCachedImage(item.GetCachedVideoThumb(), true);
- }
- else
- {
- CTextureCache::Get().ClearCachedImage(item.GetCachedVideoThumb(), true);
- CTextureCache::Get().ClearCachedImage(item.GetCachedFanart(), true);
- }
-
- // tell our GUI to completely reload all controls (as some of them
- // are likely to have had this image in use so will need refreshing)
- CGUIMessage msg(GUI_MSG_NOTIFY_ALL, 0, 0, GUI_MSG_REFRESH_THUMBS);
- g_windowManager.SendThreadMessage(msg);
-}
-
void CVideoDatabase::SetDetail(const CStdString& strDetail, int id, int field,
VIDEODB_CONTENT_TYPE type)
{
@@ -414,15 +414,15 @@ class CVideoDatabase : public CDatabase
void SetStreamDetailsForFileId(const CStreamDetails& details, int idFile);
void SetDetail(const CStdString& strDetail, int id, int field, VIDEODB_CONTENT_TYPE type);
- void DeleteMovie(int idMovie, bool bKeepId = false, bool bKeepThumb = false);
- void DeleteMovie(const CStdString& strFilenameAndPath, bool bKeepId = false, bool bKeepThumb = false, int idMovie = -1);
- void DeleteTvShow(int idTvShow, bool bKeepId = false, bool bKeepThumb = false);
- void DeleteTvShow(const CStdString& strPath, bool bKeepId = false, bool bKeepThumb = false, int idTvShow = -1);
- void DeleteEpisode(int idEpisode, bool bKeepId = false, bool bKeepThumb = false);
- void DeleteEpisode(const CStdString& strFilenameAndPath, int idEpisode = -1, bool bKeepId = false, bool bKeepThumb = false);
- void DeleteMusicVideo(int idMusicVideo, bool bKeepId = false, bool bKeepThumb = false);
- void DeleteMusicVideo(const CStdString& strFilenameAndPath, bool bKeepId = false, bool bKeepThumb = false, int idMVideo = -1);
- void DeleteDetailsForTvShow(const CStdString& strPath, bool bKeepThumb = false, int idTvShow = -1);
+ void DeleteMovie(int idMovie, bool bKeepId = false);
+ void DeleteMovie(const CStdString& strFilenameAndPath, bool bKeepId = false, int idMovie = -1);
+ void DeleteTvShow(int idTvShow, bool bKeepId = false);
+ void DeleteTvShow(const CStdString& strPath, bool bKeepId = false, int idTvShow = -1);
+ void DeleteEpisode(int idEpisode, bool bKeepId = false);
+ void DeleteEpisode(const CStdString& strFilenameAndPath, int idEpisode = -1, bool bKeepId = false);
+ void DeleteMusicVideo(int idMusicVideo, bool bKeepId = false);
+ void DeleteMusicVideo(const CStdString& strFilenameAndPath, bool bKeepId = false, int idMVideo = -1);
+ void DeleteDetailsForTvShow(const CStdString& strPath, int idTvShow = -1);
void RemoveContentForPath(const CStdString& strPath,CGUIDialogProgress *progress = NULL);
void UpdateFanart(const CFileItem &item, VIDEODB_CONTENT_TYPE type);
void DeleteSet(int idSet);
@@ -763,7 +763,6 @@ class CVideoDatabase : public CDatabase
void ConstructPath(CStdString& strDest, const CStdString& strPath, const CStdString& strFileName);
void SplitPath(const CStdString& strFileNameAndPath, CStdString& strPath, CStdString& strFileName);
void InvalidatePathHash(const CStdString& strPath);
- void DeleteThumbForItem(const CStdString& strPath, bool bFolder, int idEpisode = -1);
bool GetStackedTvShowList(int idShow, CStdString& strIn);
void Stack(CFileItemList& items, VIDEODB_CONTENT_TYPE type, bool maintainSortOrder = false);

0 comments on commit 61f1129

Please sign in to comment.