aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvdrfan <vdrfan-nospam-@xbmc.org>2011-12-04 16:10:22 +0100
committervdrfan <vdrfan-nospam-@xbmc.org>2011-12-04 16:10:22 +0100
commit019f873e7c08c53b3ff77282083c1b8b549922e8 (patch)
tree3896293c3f4cfa94397419a1f5bad7a6202e8247
parent23bfcba640a7bc96d339ec619fcd4eaabe83f95f (diff)
changed: made CVideoDatabase::Get*Info to return bool
-rw-r--r--xbmc/video/VideoDatabase.cpp34
-rw-r--r--xbmc/video/VideoDatabase.h8
2 files changed, 25 insertions, 17 deletions
diff --git a/xbmc/video/VideoDatabase.cpp b/xbmc/video/VideoDatabase.cpp
index e2960f7621..9cc3e2117a 100644
--- a/xbmc/video/VideoDatabase.cpp
+++ b/xbmc/video/VideoDatabase.cpp
@@ -1525,44 +1525,48 @@ void CVideoDatabase::GetMusicVideosByArtist(const CStdString& strArtist, CFileIt
}
//********************************************************************************************************************************
-void CVideoDatabase::GetMovieInfo(const CStdString& strFilenameAndPath, CVideoInfoTag& details, int idMovie /* = -1 */)
+bool CVideoDatabase::GetMovieInfo(const CStdString& strFilenameAndPath, CVideoInfoTag& details, int idMovie /* = -1 */)
{
try
{
// TODO: Optimize this - no need for all the queries!
if (idMovie < 0)
idMovie = GetMovieId(strFilenameAndPath);
- if (idMovie < 0) return ;
+ if (idMovie < 0) return false;
CStdString sql = PrepareSQL("select * from movieview where idMovie=%i", idMovie);
if (!m_pDS->query(sql.c_str()))
- return;
+ return false;
details = GetDetailsForMovie(m_pDS, true);
+ return !details.IsEmpty();
}
catch (...)
{
CLog::Log(LOGERROR, "%s (%s) failed", __FUNCTION__, strFilenameAndPath.c_str());
}
+ return false;
}
//********************************************************************************************************************************
-void CVideoDatabase::GetTvShowInfo(const CStdString& strPath, CVideoInfoTag& details, int idTvShow /* = -1 */)
+bool CVideoDatabase::GetTvShowInfo(const CStdString& strPath, CVideoInfoTag& details, int idTvShow /* = -1 */)
{
try
{
if (idTvShow < 0)
idTvShow = GetTvShowId(strPath);
- if (idTvShow < 0) return ;
+ if (idTvShow < 0) return false;
CStdString sql = PrepareSQL("SELECT * FROM tvshowview WHERE idShow=%i", idTvShow);
if (!m_pDS->query(sql.c_str()))
- return;
+ return false;
details = GetDetailsForTvShow(m_pDS, true);
+ return !details.IsEmpty();
}
catch (...)
{
CLog::Log(LOGERROR, "%s (%s) failed", __FUNCTION__, strPath.c_str());
}
+ return false;
}
bool CVideoDatabase::GetEpisodeInfo(const CStdString& strFilenameAndPath, CVideoInfoTag& details, int idEpisode /* = -1 */)
@@ -1578,7 +1582,7 @@ bool CVideoDatabase::GetEpisodeInfo(const CStdString& strFilenameAndPath, CVideo
if (!m_pDS->query(sql.c_str()))
return false;
details = GetDetailsForEpisode(m_pDS, true);
- return true;
+ return !details.IsEmpty();
}
catch (...)
{
@@ -1587,46 +1591,50 @@ bool CVideoDatabase::GetEpisodeInfo(const CStdString& strFilenameAndPath, CVideo
return false;
}
-void CVideoDatabase::GetMusicVideoInfo(const CStdString& strFilenameAndPath, CVideoInfoTag& details, int idMVideo /* = -1 */)
+bool CVideoDatabase::GetMusicVideoInfo(const CStdString& strFilenameAndPath, CVideoInfoTag& details, int idMVideo /* = -1 */)
{
try
{
// TODO: Optimize this - no need for all the queries!
if (idMVideo < 0)
idMVideo = GetMusicVideoId(strFilenameAndPath);
- if (idMVideo < 0) return ;
+ if (idMVideo < 0) return false;
CStdString sql = PrepareSQL("select * from musicvideoview where idMVideo=%i", idMVideo);
if (!m_pDS->query(sql.c_str()))
- return;
+ return false;
details = GetDetailsForMusicVideo(m_pDS);
+ return !details.IsEmpty();
}
catch (...)
{
CLog::Log(LOGERROR, "%s (%s) failed", __FUNCTION__, strFilenameAndPath.c_str());
}
+ return false;
}
-void CVideoDatabase::GetSetInfo(int idSet, CVideoInfoTag& details)
+bool CVideoDatabase::GetSetInfo(int idSet, CVideoInfoTag& details)
{
try
{
if (idSet < 0)
- return;
+ return false;
CStdString where = PrepareSQL("WHERE sets.idSet=%d", idSet);
CFileItemList items;
if (!GetSetsNav("videodb://1/7/", items, VIDEODB_CONTENT_MOVIES, where) ||
items.Size() != 1 ||
!items[0]->HasVideoInfoTag())
- return;
+ return false;
details = *(items[0]->GetVideoInfoTag());
+ return !details.IsEmpty();
}
catch (...)
{
CLog::Log(LOGERROR, "%s (%d) failed", __FUNCTION__, idSet);
}
+ return false;
}
void CVideoDatabase::AddGenreAndDirectorsAndStudios(const CVideoInfoTag& details, vector<int>& vecDirectors, vector<int>& vecGenres, vector<int>& vecStudios)
diff --git a/xbmc/video/VideoDatabase.h b/xbmc/video/VideoDatabase.h
index 4b470a094b..b6775d214f 100644
--- a/xbmc/video/VideoDatabase.h
+++ b/xbmc/video/VideoDatabase.h
@@ -380,11 +380,11 @@ public:
int GetTvShowForEpisode(int idEpisode);
bool LoadVideoInfo(const CStdString& strFilenameAndPath, CVideoInfoTag& details);
- void GetMovieInfo(const CStdString& strFilenameAndPath, CVideoInfoTag& details, int idMovie = -1);
- void GetTvShowInfo(const CStdString& strPath, CVideoInfoTag& details, int idTvShow = -1);
+ bool GetMovieInfo(const CStdString& strFilenameAndPath, CVideoInfoTag& details, int idMovie = -1);
+ bool GetTvShowInfo(const CStdString& strPath, CVideoInfoTag& details, int idTvShow = -1);
bool GetEpisodeInfo(const CStdString& strFilenameAndPath, CVideoInfoTag& details, int idEpisode = -1);
- void GetMusicVideoInfo(const CStdString& strFilenameAndPath, CVideoInfoTag& details, int idMVideo=-1);
- void GetSetInfo(int idSet, CVideoInfoTag& details);
+ bool GetMusicVideoInfo(const CStdString& strFilenameAndPath, CVideoInfoTag& details, int idMVideo=-1);
+ bool GetSetInfo(int idSet, CVideoInfoTag& details);
int GetPathId(const CStdString& strPath);
int GetTvShowId(const CStdString& strPath);