get rid of unused video thumb functions
authorJonathan Marshall <jmarshall@never.you.mind>
Wed, 29 Feb 2012 01:33:46 +0000 (14:33 +1300)
committerJonathan Marshall <jmarshall@never.you.mind>
Tue, 8 May 2012 06:14:38 +0000 (18:14 +1200)
xbmc/FileItem.cpp
xbmc/FileItem.h
xbmc/ThumbnailCache.cpp
xbmc/ThumbnailCache.h
xbmc/video/VideoInfoScanner.cpp
xbmc/video/VideoInfoScanner.h

index 3030f28..3ee1ea4 100644 (file)
@@ -988,16 +988,6 @@ CStdString CFileItem::GetCachedArtistThumb() const
   return CThumbnailCache::GetArtistThumb(*this);
 }
 
-CStdString CFileItem::GetCachedSeasonThumb() const
-{
-  return CThumbnailCache::GetSeasonThumb(*this);
-}
-
-CStdString CFileItem::GetCachedActorThumb() const
-{
-  return CThumbnailCache::GetActorThumb(*this);
-}
-
 void CFileItem::SetCachedArtistThumb()
 {
   CStdString thumb(GetCachedArtistThumb());
@@ -1018,16 +1008,6 @@ void CFileItem::SetMusicThumb(bool alwaysCheckRemote /* = true */)
     SetUserMusicThumb(alwaysCheckRemote);
 }
 
-void CFileItem::SetCachedSeasonThumb()
-{
-  CStdString thumb(GetCachedSeasonThumb());
-  if (CFile::Exists(thumb))
-  {
-    // found it, we are finished.
-    SetThumbnailImage(thumb);
-  }
-}
-
 void CFileItem::RemoveExtension()
 {
   if (m_bIsFolder)
@@ -2396,17 +2376,6 @@ bool CFileItemList::AlwaysCache() const
   return false;
 }
 
-void CFileItemList::SetCachedVideoThumbs()
-{
-  CSingleLock lock(m_lock);
-  // TODO: Investigate caching time to see if it speeds things up
-  for (unsigned int i = 0; i < m_items.size(); ++i)
-  {
-    CFileItemPtr pItem = m_items[i];
-    pItem->SetCachedVideoThumb();
-  }
-}
-
 void CFileItemList::SetCachedMusicThumbs()
 {
   CSingleLock lock(m_lock);
@@ -2548,31 +2517,6 @@ void CFileItem::SetUserMusicThumb(bool alwaysCheckRemote /* = false */)
   SetCachedMusicThumb();
 }
 
-CStdString CFileItem::GetCachedVideoThumb() const
-{
-  return CThumbnailCache::GetVideoThumb(*this);
-}
-
-CStdString CFileItem::GetCachedEpisodeThumb() const
-{
-  return CThumbnailCache::GetEpisodeThumb(*this);
-}
-
-void CFileItem::SetCachedVideoThumb()
-{
-  if (IsParentFolder()) return;
-  if (HasThumbnail()) return;
-  CStdString cachedThumb(GetCachedVideoThumb());
-  if (HasVideoInfoTag() && !m_bIsFolder  &&
-      GetVideoInfoTag()->m_iEpisode > -1 &&
-      CFile::Exists(GetCachedEpisodeThumb()))
-  {
-    SetThumbnailImage(GetCachedEpisodeThumb());
-  }
-  else if (CFile::Exists(cachedThumb))
-    SetThumbnailImage(cachedThumb);
-}
-
 // Gets the .tbn filename from a file or folder name.
 // <filename>.ext -> <filename>.tbn
 // <foldername>/ -> <foldername>.tbn
@@ -2786,29 +2730,6 @@ bool CFileItem::testGetBaseMoviePath()
 }
 #endif
 
-void CFileItem::SetVideoThumb()
-{
-  if (HasThumbnail()) return;
-  SetCachedVideoThumb();
-  if (!HasThumbnail())
-    SetUserVideoThumb();
-}
-
-void CFileItem::SetUserVideoThumb()
-{
-  if (m_bIsShareOrDrive) return;
-  if (IsParentFolder()) return;
-
-  // caches as the local thumb
-  CStdString thumb(GetUserVideoThumb());
-  if (!thumb.IsEmpty())
-  {
-    CStdString cachedThumb(GetCachedVideoThumb());
-    CPicture::CreateThumbnail(thumb, cachedThumb);
-  }
-  SetCachedVideoThumb();
-}
-
 bool CFileItem::CacheLocalFanart() const
 {
   // first check for an already cached fanart image
index 4e5eb79..893d948 100644 (file)
@@ -199,11 +199,7 @@ public:
   CPictureInfoTag* GetPictureInfoTag();
 
   // Gets the cached thumb filename (no existence checks)
-  CStdString GetCachedVideoThumb() const;
-  CStdString GetCachedEpisodeThumb() const;
   CStdString GetCachedArtistThumb() const;
-  CStdString GetCachedSeasonThumb() const;
-  CStdString GetCachedActorThumb() const;
   /*!
    \brief Get the cached fanart path for this item if it exists
    \return path to the cached fanart for this item, or empty if none exists
@@ -212,8 +208,6 @@ public:
   CStdString GetCachedFanart() const;
   static CStdString GetCachedThumb(const CStdString &path, const CStdString& strPath2, bool split=false);
 
-  // Sets the video thumb (cached first, else caches user thumb)
-  void SetVideoThumb();
   /*!
    \brief Cache a copy of the local fanart for this item if we don't already have an image cached
    \return true if we already have cached fanart or if the caching was successful, false if no image is cached.
@@ -228,10 +222,8 @@ public:
   CStdString GetLocalFanart() const;
 
   // Sets the cached thumb for the item if it exists
-  void SetCachedVideoThumb();
   void SetCachedArtistThumb();
   void SetCachedMusicThumb();
-  void SetCachedSeasonThumb();
 
   // Gets the .tbn file associated with this item
   CStdString GetTBNFile() const;
@@ -258,7 +250,6 @@ public:
   CStdString GetUserMusicThumb(bool alwaysCheckRemote = false) const;
 
   // Caches the user thumb and assigns it to the item
-  void SetUserVideoThumb();
   void SetUserMusicThumb(bool alwaysCheckRemote = false);
 
   /*! \brief Get the path where we expect local metadata to reside.
@@ -471,7 +462,6 @@ public:
   void RemoveDiscCache(int windowID = 0) const;
   bool AlwaysCache() const;
 
-  void SetCachedVideoThumbs();
   void SetCachedMusicThumbs();
 
   void Swap(unsigned int item1, unsigned int item2);
index ebc5d27..9ccfa24 100644 (file)
@@ -154,60 +154,6 @@ CStdString CThumbnailCache::GetArtistThumb(const CStdString &label)
   return GetThumb("artist" + label, g_settings.GetMusicArtistThumbFolder());
 }
 
-CStdString CThumbnailCache::GetActorThumb(const CFileItem &item)
-{
-  return GetActorThumb(item.GetLabel());
-}
-
-CStdString CThumbnailCache::GetActorThumb(const CStdString &label)
-{
-  return GetThumb("actor" + label, g_settings.GetVideoThumbFolder(), true);
-}
-
-CStdString CThumbnailCache::GetSeasonThumb(const CFileItem &item)
-{
-  return GetSeasonThumb(item.GetLabel(), item.GetVideoInfoTag());
-}
-
-CStdString CThumbnailCache::GetSeasonThumb(const CStdString &label, const CVideoInfoTag *videoInfo /* = NULL */)
-{
-  CStdString seasonPath;
-  if (videoInfo)
-    seasonPath = videoInfo->m_strPath;
-
-  return GetThumb("season" + seasonPath + label, g_settings.GetVideoThumbFolder(), true);
-}
-
-CStdString CThumbnailCache::GetEpisodeThumb(const CFileItem &item)
-{
-  if (!item.HasVideoInfoTag())
-    return CStdString();
-
-  return GetEpisodeThumb(item.GetVideoInfoTag());
-}
-
-CStdString CThumbnailCache::GetEpisodeThumb(const CVideoInfoTag* videoInfo)
-{
-  // get the locally cached thumb
-  CStdString strCRC;
-  strCRC.Format("%sepisode%i", videoInfo->m_strFileNameAndPath.c_str(), videoInfo->m_iEpisode);
-  return GetThumb(strCRC, g_settings.GetVideoThumbFolder(), true);
-}
-
-CStdString CThumbnailCache::GetVideoThumb(const CFileItem &item)
-{
-  if (item.IsStack())
-    return GetThumb(CStackDirectory::GetFirstStackedFile(item.GetPath()), g_settings.GetVideoThumbFolder(), true);
-  else if (item.IsVideoDb() && item.HasVideoInfoTag())
-  {
-    if (item.m_bIsFolder && !item.GetVideoInfoTag()->m_strPath.IsEmpty())
-      return GetThumb(item.GetVideoInfoTag()->m_strPath, g_settings.GetVideoThumbFolder(), true);
-    else if (!item.GetVideoInfoTag()->m_strFileNameAndPath.IsEmpty())
-      return GetThumb(item.GetVideoInfoTag()->m_strFileNameAndPath, g_settings.GetVideoThumbFolder(), true);
-  }
-  return GetThumb(item.GetPath(), g_settings.GetVideoThumbFolder(), true);
-}
-
 CStdString CThumbnailCache::GetFanart(const CFileItem &item)
 {
   // get the locally cached thumb
index 2435a75..fe1c961 100644 (file)
@@ -55,13 +55,6 @@ public:
   static CStdString GetArtistThumb(const CArtist &artist);
   static CStdString GetArtistThumb(const CFileItem &item);
   static CStdString GetArtistThumb(const CStdString &label);
-  static CStdString GetActorThumb(const CFileItem &item);
-  static CStdString GetActorThumb(const CStdString &label);
-  static CStdString GetSeasonThumb(const CFileItem &item);
-  static CStdString GetSeasonThumb(const CStdString &label, const CVideoInfoTag *videoInfo = NULL);
-  static CStdString GetEpisodeThumb(const CFileItem &item);
-  static CStdString GetEpisodeThumb(const CVideoInfoTag *videoInfo);
-  static CStdString GetVideoThumb(const CFileItem &item);
   static CStdString GetFanart(const CFileItem &item);
   static CStdString GetThumb(const CStdString &path, const CStdString &path2, bool split = false);
 protected:
index 8a2476f..14cc997 100644 (file)
@@ -1604,66 +1604,6 @@ namespace VIDEO
     for (map<int, string>::iterator i = art.begin(); i != art.end(); ++i)
       CTextureCache::Get().BackgroundCacheImage(i->second);
   }
-  
-  void CVideoInfoScanner::FetchSeasonThumbs(int idTvShow, const CStdString &folderToCheck, bool download, bool overwrite)
-  {
-    // ensure our database is open (this can get called via other classes)
-    if (!m_database.Open())
-      return;
-
-    CVideoInfoTag movie;
-    m_database.GetTvShowInfo("", movie, idTvShow);
-    CStdString showDir(folderToCheck.IsEmpty() ? movie.m_strPath : folderToCheck);
-    CFileItemList items;
-    CStdString strPath;
-    strPath.Format("videodb://2/2/%i/", idTvShow);
-    m_database.GetSeasonsNav(strPath, items, -1, -1, -1, -1, idTvShow);
-    CFileItemPtr pItem;
-    pItem.reset(new CFileItem(g_localizeStrings.Get(20366)));  // "All Seasons"
-    CStdString path; path.Format("%s/-1/", strPath.c_str());
-    pItem->SetPath(path);
-    pItem->GetVideoInfoTag()->m_iSeason = -1;
-    pItem->GetVideoInfoTag()->m_strPath = movie.m_strPath;
-    if (overwrite || !XFILE::CFile::Exists(pItem->GetCachedSeasonThumb()))
-      items.Add(pItem);
-
-    // used for checking for a season[ ._-](number).tbn
-    CFileItemList tbnItems;
-    CDirectory::GetDirectory(showDir, tbnItems, ".tbn");
-    for (int i=0;i<items.Size();++i)
-    {
-      if (overwrite || !items[i]->HasThumbnail())
-      {
-        CStdString strExpression;
-        int iSeason = items[i]->GetVideoInfoTag()->m_iSeason;
-        if (iSeason == -1)
-          strExpression = "season-all.tbn";
-        else if (iSeason == 0)
-          strExpression = "season-specials.tbn";
-        else
-          strExpression.Format("season[ ._-]?(0?%i)\\.tbn", items[i]->GetVideoInfoTag()->m_iSeason);
-        bool bDownload = download;
-        CRegExp reg;
-        if (reg.RegComp(strExpression.c_str()))
-        {
-          for (int j=0;j<tbnItems.Size();++j)
-          {
-            CStdString strCheck = URIUtils::GetFileName(tbnItems[j]->GetPath());
-            strCheck.ToLower();
-            if (reg.RegFind(strCheck.c_str()) > -1)
-            {
-              CPicture::CreateThumbnail(tbnItems[j]->GetPath(), items[i]->GetCachedSeasonThumb());
-              bDownload=false;
-              break;
-            }
-          }
-        }
-        if (bDownload)
-          DownloadImage(CScraperUrl::GetThumbURL(movie.m_strPictureURL.GetSeasonThumb(items[i]->GetVideoInfoTag()->m_iSeason)), items[i]->GetCachedSeasonThumb());
-      }
-    }
-    m_database.Close();
-  }
 
   void CVideoInfoScanner::FetchActorThumbs(vector<SActorInfo>& actors, const CStdString& strPath)
   {
index ecbdda2..526b109 100644 (file)
@@ -117,16 +117,6 @@ namespace VIDEO
     static bool DownloadFailed(CGUIDialogProgress* pDlgProgress);
     CNfoFile::NFOResult CheckForNFOFile(CFileItem* pItem, bool bGrabAny, ADDON::ScraperPtr& scraper, CScraperUrl& scrUrl);
 
-    /*! \brief Fetch thumbs for seasons for a given show
-     Fetches and caches local season thumbs of the form season##.tbn and season-all.tbn for the current show,
-     and downloads online thumbs if they don't exist.
-     \param idTvShow database id of the tvshow.
-     \param folderToCheck folder to check for local thumbs, if other than the show folder.  Defaults to empty.
-     \param download whether we should download thumbs that don't exist.  Defaults to true.
-     \param overwrite whether to overwrite currently cached thumbs.  Defaults to false.
-     */
-    void FetchSeasonThumbs(int idTvShow, const CStdString &folderToCheck = "", bool download = true, bool overwrite = false);
-
     /*! \brief Retrieve any artwork associated with an item
      \param pItem item to find artwork for.
      \param content content type of the item.