added: ListItem.Property(TotalSeasons) (fixes #11072)
authorvdrfan <vdrfan-nospam@xbmc.org>
Mon, 21 Feb 2011 05:57:52 +0000 (06:57 +0100)
committervdrfan <vdrfan-nospam@xbmc.org>
Mon, 21 Feb 2011 05:58:23 +0000 (06:58 +0100)
xbmc/video/VideoDatabase.cpp
xbmc/video/VideoDatabase.h

index 1d4625e..5829c7a 100644 (file)
@@ -56,12 +56,13 @@ using namespace VIDEO;
 using namespace ADDON;
 
 #define VIDEO_DATABASE_VIEW_TVSHOW "SELECT tvshow.*,path.strPath AS strPath," \
-                                   "counts.totalcount AS totalCount,counts.watchedcount AS watchedCount," \
-                                   "counts.totalcount=counts.watchedcount AS watched FROM tvshow " \
+                                   "counts.totalcount AS totalCount," \
+                                   "counts.watchedcount AS watchedCount," \
+                                   "counts.totalseasons AS totalSeasons FROM tvshow " \
                                    "JOIN tvshowlinkpath ON tvshow.idShow=tvshowlinkpath.idShow " \
                                    "JOIN path ON path.idpath=tvshowlinkpath.idPath " \
                                    "LEFT OUTER join (" \
-                                   "    SELECT tvshow.idShow AS idShow,count(1) AS totalcount,count(files.playCount) AS watchedcount FROM tvshow " \
+                                   "    SELECT tvshow.idShow AS idShow,count(1) AS totalcount,count(files.playCount) AS watchedcount,episode.c12 AS totalSeasons FROM tvshow " \
                                    "    JOIN tvshowlinkepisode ON tvshow.idShow=tvshowlinkepisode.idShow " \
                                    "    JOIN episode ON episode.idEpisode=tvshowlinkepisode.idEpisode " \
                                    "    JOIN files ON files.idFile=episode.idFile " \
@@ -4612,6 +4613,7 @@ bool CVideoDatabase::GetTvShowsByWhere(const CStdString& strBaseDir, const CStdS
     while (!m_pDS->eof())
     {
       int idShow = m_pDS->fv("tvshow.idShow").get_asInt();
+      int numSeasons = m_pDS->fv(VIDEODB_DETAILS_TVSHOW_NUM_SEASONS).get_asInt();
 
       CVideoInfoTag movie = GetDetailsForTvShow(m_pDS, false);
       if (!g_advancedSettings.m_bVideoLibraryHideEmptySeries || movie.m_iEpisode > 0)
@@ -4620,6 +4622,7 @@ bool CVideoDatabase::GetTvShowsByWhere(const CStdString& strBaseDir, const CStdS
         pItem->m_strPath.Format("%s%ld/", strBaseDir.c_str(), idShow);
         pItem->m_dateTime.SetFromDateString(movie.m_strPremiered);
         pItem->GetVideoInfoTag()->m_iYear = pItem->m_dateTime.GetYear();
+        pItem->SetProperty("totalseasons", numSeasons);
         pItem->SetProperty("totalepisodes", movie.m_iEpisode);
         pItem->SetProperty("numepisodes", movie.m_iEpisode); // will be changed later to reflect watchmode setting
         pItem->SetProperty("watchedepisodes", movie.m_playCount);
index cd5670c..602bd7b 100644 (file)
@@ -74,6 +74,7 @@ namespace VIDEO
 #define VIDEODB_DETAILS_TVSHOW_PATH            VIDEODB_MAX_COLUMNS + 1
 #define VIDEODB_DETAILS_TVSHOW_NUM_EPISODES    VIDEODB_MAX_COLUMNS + 2
 #define VIDEODB_DETAILS_TVSHOW_NUM_WATCHED     VIDEODB_MAX_COLUMNS + 3
+#define VIDEODB_DETAILS_TVSHOW_NUM_SEASONS     VIDEODB_MAX_COLUMNS + 4
 
 
 #define VIDEODB_TYPE_STRING 1