diff options
author | Jonathan Marshall <jmarshall@never.you.mind> | 2012-05-08 21:35:22 +1200 |
---|---|---|
committer | Jonathan Marshall <jmarshall@never.you.mind> | 2012-05-08 21:42:31 +1200 |
commit | 2fc3a8fc7d9062aabfc1b6caac1be1142b00425a (patch) | |
tree | 0f29e1ca23bdd38e86cf7b4f44268964c7a2a3f5 | |
parent | ed6a28a53d8ad7cc3765ec55fba29603660b2518 (diff) |
add idShow to the episode table and drop the unneeded tvshowlinkepisode
-rw-r--r-- | xbmc/video/VideoDatabase.cpp | 89 | ||||
-rw-r--r-- | xbmc/video/VideoDatabase.h | 20 |
2 files changed, 56 insertions, 53 deletions
diff --git a/xbmc/video/VideoDatabase.cpp b/xbmc/video/VideoDatabase.cpp index 01f0aaf918..3b3f24dc70 100644 --- a/xbmc/video/VideoDatabase.cpp +++ b/xbmc/video/VideoDatabase.cpp @@ -212,11 +212,8 @@ bool CVideoDatabase::CreateTables() m_pDS->exec(createColIndex.c_str()); createColIndex.Format("CREATE INDEX ix_episode_bookmark on episode (c%02d)", VIDEODB_ID_EPISODE_BOOKMARK); m_pDS->exec(createColIndex.c_str()); - - CLog::Log(LOGINFO, "create tvshowlinkepisode table"); - m_pDS->exec("CREATE TABLE tvshowlinkepisode ( idShow integer, idEpisode integer)\n"); - m_pDS->exec("CREATE UNIQUE INDEX ix_tvshowlinkepisode_1 ON tvshowlinkepisode ( idShow, idEpisode )\n"); - m_pDS->exec("CREATE UNIQUE INDEX ix_tvshowlinkepisode_2 ON tvshowlinkepisode ( idEpisode, idShow )\n"); + m_pDS->exec("CREATE INDEX ix_episode_show1 on episode(idEpisode,idShow)"); + m_pDS->exec("CREATE INDEX ix_episode_show2 on episode(idShow,idEpisode)"); CLog::Log(LOGINFO, "create tvshowlinkpath table"); m_pDS->exec("CREATE TABLE tvshowlinkpath (idShow integer, idPath integer)\n"); @@ -351,17 +348,14 @@ void CVideoDatabase::CreateViews() " files.dateAdded AS dateAdded," " tvshow.c%02d AS strTitle," " tvshow.c%02d AS strStudio," - " tvshow.idShow AS idShow," " tvshow.c%02d AS premiered," " tvshow.c%02d AS mpaa," " tvshow.c%02d AS strShowPath " "FROM episode" " JOIN files ON" " files.idFile=episode.idFile" - " JOIN tvshowlinkepisode ON" - " episode.idEpisode=tvshowlinkepisode.idEpisode" " JOIN tvshow ON" - " tvshow.idShow=tvshowlinkepisode.idShow" + " tvshow.idShow=episode.idShow" " JOIN path ON" " files.idPath=path.idPath", VIDEODB_ID_TV_TITLE, VIDEODB_ID_TV_STUDIOS, VIDEODB_ID_TV_PREMIERED, VIDEODB_ID_TV_MPAA, VIDEODB_ID_TV_BASEPATH); m_pDS->exec(episodeview.c_str()); @@ -380,10 +374,8 @@ void CVideoDatabase::CreateViews() " tvshowlinkpath.idShow=tvshow.idShow" " LEFT JOIN path ON" " path.idPath=tvshowlinkpath.idPath" - " LEFT JOIN tvshowlinkepisode ON" - " tvshowlinkepisode.idShow=tvshow.idShow" " LEFT JOIN episode ON" - " episode.idEpisode=tvshowlinkepisode.idEpisode" + " episode.idShow=tvshow.idShow" " LEFT JOIN files ON" " files.idFile=episode.idFile " "GROUP BY tvshow.idShow;"); @@ -528,7 +520,7 @@ bool CVideoDatabase::GetPathsForTvShow(int idShow, set<int>& paths) { if (NULL == m_pDB.get()) return false; if (NULL == m_pDS.get()) return false; - strSQL = PrepareSQL("SELECT DISTINCT idPath FROM files JOIN episode ON episode.idFile=files.idFile JOIN tvshowlinkepisode ON tvshowlinkepisode.idEpisode=episode.idEpisode WHERE tvshowlinkepisode.idShow=%i",idShow); + strSQL = PrepareSQL("SELECT DISTINCT idPath FROM files JOIN episode ON episode.idFile=files.idFile WHERE episode.idShow=%i",idShow); m_pDS->query(strSQL.c_str()); while (!m_pDS->eof()) { @@ -1145,14 +1137,7 @@ int CVideoDatabase::AddEpisode(int idShow, const CStdString& strFilenameAndPath) CStdString strSQL=PrepareSQL("insert into episode (idEpisode, idFile) values (NULL, %i)", idFile); m_pDS->exec(strSQL.c_str()); - int idEpisode = (int)m_pDS->lastinsertid(); - - strSQL=PrepareSQL("insert into tvshowlinkepisode (idShow,idEpisode) values (%i,%i)",idShow,idEpisode); - m_pDS->exec(strSQL.c_str()); - -// CommitTransaction(); - - return idEpisode; + return m_pDS->lastinsertid(); } catch (...) { @@ -2591,7 +2576,7 @@ void CVideoDatabase::DeleteTvShow(const CStdString& strPath, bool bKeepId /* = f BeginTransaction(); - CStdString strSQL=PrepareSQL("select tvshowlinkepisode.idEpisode,path.strPath,files.strFileName from tvshowlinkepisode,path,files,episode where tvshowlinkepisode.idShow=%i and tvshowlinkepisode.idEpisode=episode.idEpisode and episode.idFile=files.idFile and files.idPath=path.idPath",idTvShow); + CStdString strSQL=PrepareSQL("select episode.idEpisode,path.strPath,files.strFileName from episode,path,files where episode.idShow=%i and episode.idFile=files.idFile and files.idPath=path.idPath",idTvShow); m_pDS2->query(strSQL.c_str()); while (!m_pDS2->eof()) { @@ -2678,9 +2663,6 @@ void CVideoDatabase::DeleteEpisode(const CStdString& strFilenameAndPath, int idE { ClearBookMarksOfFile(strFilenameAndPath); - strSQL=PrepareSQL("delete from tvshowlinkepisode where idEpisode=%i", idEpisode); - m_pDS->exec(strSQL.c_str()); - strSQL=PrepareSQL("delete from episode where idEpisode=%i", idEpisode); m_pDS->exec(strSQL.c_str()); } @@ -3026,9 +3008,13 @@ CVideoInfoTag CVideoDatabase::GetDetailsForEpisode(auto_ptr<Dataset> &pDS, bool GetDetailsFromDB(pDS, VIDEODB_ID_EPISODE_MIN, VIDEODB_ID_EPISODE_MAX, DbEpisodeOffsets, details); details.m_iDbId = idEpisode; details.m_type = "episode"; - GetCommonDetails(pDS, details); - movieTime += XbmcThreads::SystemClockMillis() - time; time = XbmcThreads::SystemClockMillis(); - + details.m_iFileId = pDS->fv(VIDEODB_DETAILS_FILEID).get_asInt(); + details.m_strPath = pDS->fv(VIDEODB_DETAILS_EPISODE_PATH).get_asString(); + CStdString strFileName = pDS->fv(VIDEODB_DETAILS_EPISODE_FILE).get_asString(); + ConstructPath(details.m_strFileNameAndPath,details.m_strPath,strFileName); + details.m_playCount = pDS->fv(VIDEODB_DETAILS_EPISODE_PLAYCOUNT).get_asInt(); + details.m_lastPlayed.SetFromDBDateTime(pDS->fv(VIDEODB_DETAILS_EPISODE_LASTPLAYED).get_asString()); + details.m_dateAdded.SetFromDBDateTime(pDS->fv(VIDEODB_DETAILS_EPISODE_DATEADDED).get_asString()); details.m_strMPAARating = pDS->fv(VIDEODB_DETAILS_EPISODE_TVSHOW_MPAA).get_asString(); details.m_strShowTitle = pDS->fv(VIDEODB_DETAILS_EPISODE_TVSHOW_NAME).get_asString(); details.m_studio = StringUtils::Split(pDS->fv(VIDEODB_DETAILS_EPISODE_TVSHOW_STUDIO).get_asString(), g_advancedSettings.m_videoItemSeparator); @@ -3036,6 +3022,8 @@ CVideoInfoTag CVideoDatabase::GetDetailsForEpisode(auto_ptr<Dataset> &pDS, bool details.m_iIdShow = pDS->fv(VIDEODB_DETAILS_EPISODE_TVSHOW_ID).get_asInt(); details.m_strShowPath = pDS->fv(VIDEODB_DETAILS_EPISODE_TVSHOW_PATH).get_asString(); + movieTime += XbmcThreads::SystemClockMillis() - time; time = XbmcThreads::SystemClockMillis(); + GetStreamDetails(details); if (needsCast) @@ -3765,6 +3753,21 @@ bool CVideoDatabase::UpdateOldVersion(int iVersion) m_pDS->exec("CREATE TRIGGER delete_set AFTER DELETE ON sets FOR EACH ROW BEGIN DELETE FROM art WHERE media_id=old.idSet AND media_type='set'; END"); m_pDS->exec("CREATE TRIGGER delete_person AFTER DELETE ON actors FOR EACH ROW BEGIN DELETE FROM art WHERE media_id=old.idActor AND media_type IN ('actor','artist','writer','director'); END"); } + if (iVersion < 64) + { // add idShow to episode table + m_pDS->exec("ALTER TABLE episode ADD idShow integer"); + m_pDS->query("SELECT idEpisode FROM episode"); + while (!m_pDS->eof()) + { + int idEpisode = m_pDS->fv(0).get_asInt(); + CStdString update = PrepareSQL("UPDATE episode SET idShow=(SELECT idShow FROM tvshowlinkepisode WHERE idEpisode=%d) WHERE idEpisode=%d", idEpisode, idEpisode); + m_pDS2->exec(update.c_str()); + m_pDS->next(); + } + m_pDS->exec("DROP TABLE tvshowlinkepisode"); + m_pDS->exec("CREATE INDEX ix_episode_show1 on episode(idEpisode,idShow)"); + m_pDS->exec("CREATE INDEX ix_episode_show2 on episode(idShow,idEpisode)"); + } // always recreate the view after any table change CreateViews(); } @@ -4113,7 +4116,7 @@ bool CVideoDatabase::GetNavCommon(const CStdString& strBaseDir, CFileItemList& i strSQL = PrepareSQL("select %s.id%s,%s.str%s,path.strPath,files.playCount from %s join %slinkmovie on %s.id%s=%slinkmovie.id%s join movie on %slinkmovie.idMovie = movie.idMovie join files on files.idFile=movie.idFile join path on path.idPath=files.idPath", type.c_str(), type.c_str(), type.c_str(), type.c_str(), type.c_str(), type.c_str(), type.c_str(), type.c_str(), type.c_str(), type.c_str(), type.c_str()); else if (idContent == VIDEODB_CONTENT_TVSHOWS) //this will not get tvshows with 0 episodes - strSQL = PrepareSQL("select %s.id%s,%s.str%s,path.strPath from %s join %slinktvshow on %s.id%s=%slinktvshow.id%s join tvshow on %slinktvshow.idShow=tvshow.idShow join tvshowlinkepisode on tvshowlinkepisode.idShow=tvshow.idShow join episode on episode.idEpisode=tvshowlinkepisode.idEpisode join files on files.idFile=episode.idFile join path on path.idPath=files.idPath", + strSQL = PrepareSQL("select %s.id%s,%s.str%s,path.strPath from %s join %slinktvshow on %s.id%s=%slinktvshow.id%s join episode on %slinktvshow.idShow=episode.idShow join files on files.idFile=episode.idFile join path on path.idPath=files.idPath", type.c_str(), type.c_str(), type.c_str(), type.c_str(), type.c_str(), type.c_str(), type.c_str(), type.c_str(), type.c_str(), type.c_str(), type.c_str()); else if (idContent == VIDEODB_CONTENT_MUSICVIDEOS) strSQL = PrepareSQL("select %s.id%s,%s.str%s,path.strPath,files.playCount from %s join %slinkmusicvideo on %s.id%s=%slinkmusicvideo.id%s join musicvideo on %slinkmusicvideo.idMVideo = musicvideo.idMVideo join files on files.idFile=musicvideo.idFile join path on path.idPath=files.idPath", @@ -4480,7 +4483,7 @@ bool CVideoDatabase::GetPeopleNav(const CStdString& strBaseDir, CFileItemList& i if (idContent == VIDEODB_CONTENT_MOVIES) strSQL=PrepareSQL("select actors.idActor,actors.strActor,actors.strThumb,path.strPath,files.playCount from actors join %slinkmovie on actors.idActor=%slinkmovie.id%s join movie on %slinkmovie.idMovie=movie.idMovie join files on files.idFile=movie.idFile join path on path.idPath=files.idPath", type.c_str(), type.c_str(), type.c_str(), type.c_str()); else if (idContent == VIDEODB_CONTENT_TVSHOWS) - strSQL=PrepareSQL("select actors.idActor,actors.strActor,actors.strThumb,path.strPath from actors join %slinktvshow on actors.idActor=%slinktvshow.id%s join tvshow on %slinktvshow.idShow = tvshow.idShow join tvshowlinkepisode on tvshowlinkepisode.idShow=tvshow.idShow join episode on episode.idEpisode=tvshowlinkepisode.idEpisode join files on files.idFile=episode.idFile join path on path.idPath = files.idPath", type.c_str(), type.c_str(), type.c_str(), type.c_str()); + strSQL=PrepareSQL("select actors.idActor,actors.strActor,actors.strThumb,path.strPath from actors join %slinktvshow on actors.idActor=%slinktvshow.id%s join episode on %slinktvshow.idShow = episode.idShow join files on files.idFile=episode.idFile join path on path.idPath = files.idPath", type.c_str(), type.c_str(), type.c_str(), type.c_str()); else if (idContent == VIDEODB_CONTENT_EPISODES) strSQL=PrepareSQL("select actors.idActor,actors.strActor,actors.strThumb,path.strPath,files.playCount from actors join %slinkepisode on actors.idActor=%slinkepisode.id%s join episode on %slinkepisode.idEpisode = episode.idEpisode join files on files.idFile=episode.idFile join path on path.idPath = files.idPath", type.c_str(), type.c_str(), type.c_str(), type.c_str()); else if (idContent == VIDEODB_CONTENT_MUSICVIDEOS) @@ -4617,7 +4620,7 @@ bool CVideoDatabase::GetYearsNav(const CStdString& strBaseDir, CFileItemList& it if (idContent == VIDEODB_CONTENT_MOVIES) strSQL = PrepareSQL("select movie.c%02d,path.strPath,files.playCount from movie join files on files.idFile=movie.idFile join path on files.idPath = path.idPath", VIDEODB_ID_YEAR); else if (idContent == VIDEODB_CONTENT_TVSHOWS) - strSQL = PrepareSQL("select tvshow.c%02d,path.strPath from tvshow join files on files.idFile=episode.idFile join episode on episode.idEpisode=tvshowlinkepisode.idEpisode join tvshowlinkepisode on tvshow.idShow = tvshowlinkepisode.idShow join path on files.idPath = path.idPath", VIDEODB_ID_TV_PREMIERED); + strSQL = PrepareSQL("select tvshow.c%02d,path.strPath from tvshow join files on files.idFile=episode.idFile join episode on episode.idShow=tvshow.idShow join path on files.idPath = path.idPath", VIDEODB_ID_TV_PREMIERED); else if (idContent == VIDEODB_CONTENT_MUSICVIDEOS) strSQL = PrepareSQL("select musicvideo.c%02d,path.strPath,files.playCount from musicvideo join files on files.idFile=musicvideo.idFile join path on files.idPath = path.idPath", VIDEODB_ID_MUSICVIDEO_YEAR); } @@ -4798,10 +4801,8 @@ bool CVideoDatabase::GetSeasonsNav(const CStdString& strBaseDir, CFileItemList& " count(1)," " count(files.playCount) " "FROM episode" - " JOIN tvshowlinkepisode ON" - " tvshowlinkepisode.idEpisode=episode.idEpisode" " JOIN tvshow ON" - " tvshow.idShow=tvshowlinkepisode.idShow" + " tvshow.idShow=episode.idShow" " JOIN seasons ON" " (seasons.idShow=tvshow.idShow AND seasons.season=episode.c%02d)" " JOIN files ON" @@ -5501,7 +5502,7 @@ int CVideoDatabase::GetTvShowForEpisode(int idEpisode) if (NULL == m_pDS2.get()) return false; // make sure we use m_pDS2, as this is called in loops using m_pDS - CStdString strSQL=PrepareSQL("select idShow from tvshowlinkepisode where idEpisode=%i", idEpisode); + CStdString strSQL=PrepareSQL("select idShow from episode where idEpisode=%i", idEpisode); m_pDS2->query( strSQL.c_str() ); int result=-1; @@ -6418,9 +6419,9 @@ void CVideoDatabase::GetEpisodesByName(const CStdString& strSearch, CFileItemLis if (NULL == m_pDS.get()) return; if (g_settings.GetMasterProfile().getLockMode() != LOCK_MODE_EVERYONE && !g_passwordManager.bMasterUser) - strSQL = PrepareSQL("select episode.idEpisode,episode.c%02d,episode.c%02d,tvshowlinkepisode.idShow,tvshow.c%02d,path.strPath from episode,files,path,tvshowlinkepisode,tvshow where files.idFile=episode.idFile and tvshowlinkepisode.idEpisode=episode.idEpisode and tvshowlinkepisode.idShow=tvshow.idShow and files.idPath=path.idPath and episode.c%02d like '%%%s%%'",VIDEODB_ID_EPISODE_TITLE,VIDEODB_ID_EPISODE_SEASON,VIDEODB_ID_TV_TITLE,VIDEODB_ID_EPISODE_TITLE,strSearch.c_str()); + strSQL = PrepareSQL("select episode.idEpisode,episode.c%02d,episode.c%02d,episode.idShow,tvshow.c%02d,path.strPath from episode,files,path,tvshow where files.idFile=episode.idFile and episode.idShow=tvshow.idShow and files.idPath=path.idPath and episode.c%02d like '%%%s%%'",VIDEODB_ID_EPISODE_TITLE,VIDEODB_ID_EPISODE_SEASON,VIDEODB_ID_TV_TITLE,VIDEODB_ID_EPISODE_TITLE,strSearch.c_str()); else - strSQL = PrepareSQL("select episode.idEpisode,episode.c%02d,episode.c%02d,tvshowlinkepisode.idShow,tvshow.c%02d from episode,tvshowlinkepisode,tvshow where tvshowlinkepisode.idEpisode=episode.idEpisode and tvshow.idShow=tvshowlinkepisode.idShow and episode.c%02d like '%%%s%%'",VIDEODB_ID_EPISODE_TITLE,VIDEODB_ID_EPISODE_SEASON,VIDEODB_ID_TV_TITLE,VIDEODB_ID_EPISODE_TITLE,strSearch.c_str()); + strSQL = PrepareSQL("select episode.idEpisode,episode.c%02d,episode.c%02d,episode.idShow,tvshow.c%02d from episode,tvshow where tvshow.idShow=episode.idShow and episode.c%02d like '%%%s%%'",VIDEODB_ID_EPISODE_TITLE,VIDEODB_ID_EPISODE_SEASON,VIDEODB_ID_TV_TITLE,VIDEODB_ID_EPISODE_TITLE,strSearch.c_str()); m_pDS->query( strSQL.c_str() ); while (!m_pDS->eof()) @@ -6433,7 +6434,7 @@ void CVideoDatabase::GetEpisodesByName(const CStdString& strSearch, CFileItemLis } CFileItemPtr pItem(new CFileItem(m_pDS->fv(1).get_asString()+" ("+m_pDS->fv(4).get_asString()+")")); - CStdString path; path.Format("videodb://2/2/%ld/%ld/%ld",m_pDS->fv("tvshowlinkepisode.idShow").get_asInt(),m_pDS->fv(2).get_asInt(),m_pDS->fv(0).get_asInt()); + CStdString path; path.Format("videodb://2/2/%ld/%ld/%ld",m_pDS->fv("episode.idShow").get_asInt(),m_pDS->fv(2).get_asInt(),m_pDS->fv(0).get_asInt()); pItem->SetPath(path); pItem->m_bIsFolder=false; items.Add(pItem); @@ -6508,9 +6509,9 @@ void CVideoDatabase::GetEpisodesByPlot(const CStdString& strSearch, CFileItemLis if (NULL == m_pDS.get()) return; if (g_settings.GetMasterProfile().getLockMode() != LOCK_MODE_EVERYONE && !g_passwordManager.bMasterUser) - strSQL = PrepareSQL("select episode.idEpisode,episode.c%02d,episode.c%02d,tvshowlinkepisode.idShow,tvshow.c%02d,path.strPath from episode,files,path,tvshowlinkepisode,tvshow where files.idFile=episode.idFile and tvshowlinkepisode.idEpisode=episode.idEpisode and files.idPath=path.idPath and tvshow.idShow=tvshowlinkepisode.idShow and episode.c%02d like '%%%s%%'",VIDEODB_ID_EPISODE_TITLE,VIDEODB_ID_EPISODE_SEASON,VIDEODB_ID_TV_TITLE,VIDEODB_ID_EPISODE_PLOT,strSearch.c_str()); + strSQL = PrepareSQL("select episode.idEpisode,episode.c%02d,episode.c%02d,episode.idShow,tvshow.c%02d,path.strPath from episode,files,path,tvshow where files.idFile=episode.idFile and files.idPath=path.idPath and tvshow.idShow=episode.idShow and episode.c%02d like '%%%s%%'",VIDEODB_ID_EPISODE_TITLE,VIDEODB_ID_EPISODE_SEASON,VIDEODB_ID_TV_TITLE,VIDEODB_ID_EPISODE_PLOT,strSearch.c_str()); else - strSQL = PrepareSQL("select episode.idEpisode,episode.c%02d,episode.c%02d,tvshowlinkepisode.idShow,tvshow.c%02d from episode,tvshowlinkepisode,tvshow where tvshowlinkepisode.idEpisode=episode.idEpisode and tvshow.idShow=tvshowlinkepisode.idShow and episode.c%02d like '%%%s%%'",VIDEODB_ID_EPISODE_TITLE,VIDEODB_ID_EPISODE_SEASON,VIDEODB_ID_TV_TITLE,VIDEODB_ID_EPISODE_PLOT,strSearch.c_str()); + strSQL = PrepareSQL("select episode.idEpisode,episode.c%02d,episode.c%02d,episode.idShow,tvshow.c%02d from episode,tvshow where tvshow.idShow=episode.idShow and episode.c%02d like '%%%s%%'",VIDEODB_ID_EPISODE_TITLE,VIDEODB_ID_EPISODE_SEASON,VIDEODB_ID_TV_TITLE,VIDEODB_ID_EPISODE_PLOT,strSearch.c_str()); m_pDS->query( strSQL.c_str() ); while (!m_pDS->eof()) @@ -6523,7 +6524,7 @@ void CVideoDatabase::GetEpisodesByPlot(const CStdString& strSearch, CFileItemLis } CFileItemPtr pItem(new CFileItem(m_pDS->fv(1).get_asString()+" ("+m_pDS->fv(4).get_asString()+")")); - CStdString path; path.Format("videodb://2/2/%ld/%ld/%ld",m_pDS->fv("tvshowlinkepisode.idShow").get_asInt(),m_pDS->fv(2).get_asInt(),m_pDS->fv(0).get_asInt()); + CStdString path; path.Format("videodb://2/2/%ld/%ld/%ld",m_pDS->fv("episode.idShow").get_asInt(),m_pDS->fv(2).get_asInt(),m_pDS->fv(0).get_asInt()); pItem->SetPath(path); pItem->m_bIsFolder=false; items.Add(pItem); @@ -6955,10 +6956,6 @@ void CVideoDatabase::CleanDatabase(IVideoInfoScannerObserver* pObserver, const s CLog::Log(LOGDEBUG, "%s: Cleaning writerlinkepisode table", __FUNCTION__); sql = "delete from writerlinkepisode where idEpisode in " + episodesToDelete; m_pDS->exec(sql.c_str()); - - CLog::Log(LOGDEBUG, "%s: Cleaning tvshowlinkepisode table", __FUNCTION__); - sql = "delete from tvshowlinkepisode where idEpisode in " + episodesToDelete; - m_pDS->exec(sql.c_str()); } CLog::Log(LOGDEBUG, "%s: Cleaning paths that don't exist and have content set...", __FUNCTION__); @@ -6992,7 +6989,7 @@ void CVideoDatabase::CleanDatabase(IVideoInfoScannerObserver* pObserver, const s sql = "select tvshow.idShow from tvshow " "join tvshowlinkpath on tvshow.idShow=tvshowlinkpath.idShow " "join path on path.idPath=tvshowlinkpath.idPath " - "where tvshow.idShow not in (select idShow from tvshowlinkepisode) " + "where tvshow.idShow not in (select idShow from episode) " "and path.strContent=''"; m_pDS->query(sql.c_str()); while (!m_pDS->eof()) diff --git a/xbmc/video/VideoDatabase.h b/xbmc/video/VideoDatabase.h index d89a8e6cf9..284cf91832 100644 --- a/xbmc/video/VideoDatabase.h +++ b/xbmc/video/VideoDatabase.h @@ -66,12 +66,18 @@ namespace VIDEO #define VIDEODB_DETAILS_PLAYCOUNT VIDEODB_MAX_COLUMNS + 4 #define VIDEODB_DETAILS_LASTPLAYED VIDEODB_MAX_COLUMNS + 5 #define VIDEODB_DETAILS_DATEADDED VIDEODB_MAX_COLUMNS + 6 -#define VIDEODB_DETAILS_EPISODE_TVSHOW_NAME VIDEODB_MAX_COLUMNS + 7 -#define VIDEODB_DETAILS_EPISODE_TVSHOW_STUDIO VIDEODB_MAX_COLUMNS + 8 -#define VIDEODB_DETAILS_EPISODE_TVSHOW_ID VIDEODB_MAX_COLUMNS + 9 -#define VIDEODB_DETAILS_EPISODE_TVSHOW_AIRED VIDEODB_MAX_COLUMNS + 10 -#define VIDEODB_DETAILS_EPISODE_TVSHOW_MPAA VIDEODB_MAX_COLUMNS + 11 -#define VIDEODB_DETAILS_EPISODE_TVSHOW_PATH VIDEODB_MAX_COLUMNS + 12 + +#define VIDEODB_DETAILS_EPISODE_TVSHOW_ID VIDEODB_MAX_COLUMNS + 2 +#define VIDEODB_DETAILS_EPISODE_FILE VIDEODB_MAX_COLUMNS + 3 +#define VIDEODB_DETAILS_EPISODE_PATH VIDEODB_MAX_COLUMNS + 4 +#define VIDEODB_DETAILS_EPISODE_PLAYCOUNT VIDEODB_MAX_COLUMNS + 5 +#define VIDEODB_DETAILS_EPISODE_LASTPLAYED VIDEODB_MAX_COLUMNS + 6 +#define VIDEODB_DETAILS_EPISODE_DATEADDED VIDEODB_MAX_COLUMNS + 7 +#define VIDEODB_DETAILS_EPISODE_TVSHOW_NAME VIDEODB_MAX_COLUMNS + 8 +#define VIDEODB_DETAILS_EPISODE_TVSHOW_STUDIO VIDEODB_MAX_COLUMNS + 9 +#define VIDEODB_DETAILS_EPISODE_TVSHOW_AIRED VIDEODB_MAX_COLUMNS + 10 +#define VIDEODB_DETAILS_EPISODE_TVSHOW_MPAA VIDEODB_MAX_COLUMNS + 11 +#define VIDEODB_DETAILS_EPISODE_TVSHOW_PATH VIDEODB_MAX_COLUMNS + 12 #define VIDEODB_DETAILS_TVSHOW_PATH VIDEODB_MAX_COLUMNS + 1 #define VIDEODB_DETAILS_TVSHOW_DATEADDED VIDEODB_MAX_COLUMNS + 2 @@ -756,7 +762,7 @@ private: */ bool LookupByFolders(const CStdString &path, bool shows = false); - virtual int GetMinVersion() const { return 63; }; + virtual int GetMinVersion() const { return 64; }; virtual int GetExportVersion() const { return 1; }; const char *GetBaseDBName() const { return "MyVideos"; }; |