diff options
author | Chris Gilbert <chris@dokein.co.uk> | 2014-04-12 12:54:40 +0100 |
---|---|---|
committer | Chris Gilbert <chris@dokein.co.uk> | 2014-05-04 10:45:53 +0100 |
commit | 403f017584f31dcc8da9d1ddc6a53f9dbe87ae2b (patch) | |
tree | 67f5379dc5ce27745f6a475fb0aea354993a64c8 | |
parent | 770091c21059568937b1aa527ad6e399ece6de61 (diff) |
Extend videodatabase GetTvShowInfo api
Add an optional FileItem *, this allows the retrieval of all the
properties from a tvshow, as some are only set when a fileitem is
available.
This allows the JSON-RPC GetTVShowDetails to return watchedepisodes, and
fixes this bug:
http://forum.xbmc.org/showthread.php?tid=191142
-rw-r--r-- | xbmc/interfaces/json-rpc/VideoLibrary.cpp | 6 | ||||
-rw-r--r-- | xbmc/video/VideoDatabase.cpp | 4 | ||||
-rw-r--r-- | xbmc/video/VideoDatabase.h | 2 |
3 files changed, 7 insertions, 5 deletions
diff --git a/xbmc/interfaces/json-rpc/VideoLibrary.cpp b/xbmc/interfaces/json-rpc/VideoLibrary.cpp index 36578a6b87..7eb3ce247d 100644 --- a/xbmc/interfaces/json-rpc/VideoLibrary.cpp +++ b/xbmc/interfaces/json-rpc/VideoLibrary.cpp @@ -206,11 +206,13 @@ JSONRPC_STATUS CVideoLibrary::GetTVShowDetails(const CStdString &method, ITransp int id = (int)parameterObject["tvshowid"].asInteger(); + CFileItemPtr fileItem(new CFileItem()); CVideoInfoTag infos; - if (!videodatabase.GetTvShowInfo("", infos, id) || infos.m_iDbId <= 0) + if (!videodatabase.GetTvShowInfo("", infos, id, fileItem.get()) || infos.m_iDbId <= 0) return InvalidParams; - HandleFileItem("tvshowid", true, "tvshowdetails", CFileItemPtr(new CFileItem(infos)), parameterObject, parameterObject["properties"], result, false); + fileItem->SetFromVideoInfoTag(infos); + HandleFileItem("tvshowid", true, "tvshowdetails", fileItem, parameterObject, parameterObject["properties"], result, false); return OK; } diff --git a/xbmc/video/VideoDatabase.cpp b/xbmc/video/VideoDatabase.cpp index aa810d93c3..ba66f34406 100644 --- a/xbmc/video/VideoDatabase.cpp +++ b/xbmc/video/VideoDatabase.cpp @@ -1743,7 +1743,7 @@ bool CVideoDatabase::GetMovieInfo(const CStdString& strFilenameAndPath, CVideoIn } //******************************************************************************************************************************** -bool CVideoDatabase::GetTvShowInfo(const CStdString& strPath, CVideoInfoTag& details, int idTvShow /* = -1 */) +bool CVideoDatabase::GetTvShowInfo(const CStdString& strPath, CVideoInfoTag& details, int idTvShow /* = -1 */, CFileItem *item /* = NULL */) { try { @@ -1754,7 +1754,7 @@ bool CVideoDatabase::GetTvShowInfo(const CStdString& strPath, CVideoInfoTag& det CStdString sql = PrepareSQL("SELECT * FROM tvshowview WHERE idShow=%i", idTvShow); if (!m_pDS->query(sql.c_str())) return false; - details = GetDetailsForTvShow(m_pDS, true); + details = GetDetailsForTvShow(m_pDS, true, item); return !details.IsEmpty(); } catch (...) diff --git a/xbmc/video/VideoDatabase.h b/xbmc/video/VideoDatabase.h index 9f84b23105..40fcf1f88d 100644 --- a/xbmc/video/VideoDatabase.h +++ b/xbmc/video/VideoDatabase.h @@ -431,7 +431,7 @@ public: bool LoadVideoInfo(const CStdString& strFilenameAndPath, CVideoInfoTag& details); bool GetMovieInfo(const CStdString& strFilenameAndPath, CVideoInfoTag& details, int idMovie = -1); - bool GetTvShowInfo(const CStdString& strPath, CVideoInfoTag& details, int idTvShow = -1); + bool GetTvShowInfo(const CStdString& strPath, CVideoInfoTag& details, int idTvShow = -1, CFileItem* item = NULL); bool GetSeasonInfo(int idSeason, CVideoInfoTag& details); bool GetEpisodeInfo(const CStdString& strFilenameAndPath, CVideoInfoTag& details, int idEpisode = -1); bool GetMusicVideoInfo(const CStdString& strFilenameAndPath, CVideoInfoTag& details, int idMVideo=-1); |