diff options
author | jmarshallnz <jcmarsha@gmail.com> | 2014-01-31 13:54:26 -0800 |
---|---|---|
committer | jmarshallnz <jcmarsha@gmail.com> | 2014-01-31 13:54:26 -0800 |
commit | 1b62b15c6c57e7bfd0a24fab6db2d4574d18bd70 (patch) | |
tree | 82d7bb9c9b85f7d95696d02cf945cb284a503eb1 | |
parent | b2969b378a18852fd4d6278ab731c67df0b6c815 (diff) | |
parent | e1c47e80921ad042818f2bdb8d19c30ffae47426 (diff) |
Merge pull request #4105 from Montellese/fix_musicvideos_artists_albums
Only show albums of the selected musicvideo artist
-rw-r--r-- | xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeGrouped.cpp | 8 | ||||
-rw-r--r-- | xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeMusicVideosOverview.cpp | 1 | ||||
-rw-r--r-- | xbmc/video/VideoDatabase.cpp | 31 | ||||
-rw-r--r-- | xbmc/video/VideoDbUrl.cpp | 8 |
4 files changed, 34 insertions, 14 deletions
diff --git a/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeGrouped.cpp b/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeGrouped.cpp index bf9cfb917e..bb62dc7b04 100644 --- a/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeGrouped.cpp +++ b/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeGrouped.cpp @@ -21,6 +21,7 @@ #include "DirectoryNodeGrouped.h" #include "QueryParams.h" #include "video/VideoDatabase.h" +#include "video/VideoDbUrl.h" using namespace XFILE::VIDEODATABASEDIRECTORY; @@ -68,7 +69,12 @@ bool CDirectoryNodeGrouped::GetContent(CFileItemList& items) const if (itemType.empty()) return false; - return videodatabase.GetItems(BuildPath(), (VIDEODB_CONTENT_TYPE)params.GetContentType(), itemType, items); + // make sure to translate all IDs in the path into URL parameters + CVideoDbUrl videoUrl; + if (!videoUrl.FromString(BuildPath())) + return false; + + return videodatabase.GetItems(videoUrl.ToString(), (VIDEODB_CONTENT_TYPE)params.GetContentType(), itemType, items); } std::string CDirectoryNodeGrouped::GetContentType() const diff --git a/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeMusicVideosOverview.cpp b/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeMusicVideosOverview.cpp index 5d2f1333f8..6a4734a021 100644 --- a/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeMusicVideosOverview.cpp +++ b/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeMusicVideosOverview.cpp @@ -77,6 +77,7 @@ bool CDirectoryNodeMusicVideosOverview::GetContent(CFileItemList& items) const pItem->m_bIsFolder = true; pItem->SetCanQueue(false); + pItem->SetSpecialSort(SortSpecialOnTop); items.Add(pItem); } diff --git a/xbmc/video/VideoDatabase.cpp b/xbmc/video/VideoDatabase.cpp index 9e4b747f62..7d399d17cf 100644 --- a/xbmc/video/VideoDatabase.cpp +++ b/xbmc/video/VideoDatabase.cpp @@ -5219,20 +5219,23 @@ bool CVideoDatabase::GetMusicVideoAlbumsNav(const CStdString& strBaseDir, CFileI if (NULL == m_pDB.get()) return false; if (NULL == m_pDS.get()) return false; + CVideoDbUrl videoUrl; + if (!videoUrl.FromString(strBaseDir)) + return false; + CStdString strSQL = "select %s from musicvideoview "; Filter extFilter = filter; + extFilter.fields = PrepareSQL("musicvideoview.c%02d, musicvideoview.idMVideo, actors.strActor", VIDEODB_ID_MUSICVIDEO_ALBUM); + extFilter.AppendJoin(PrepareSQL("join artistlinkmusicvideo on artistlinkmusicvideo.idMVideo = musicvideoview.idMVideo")); + extFilter.AppendJoin(PrepareSQL("join actors on actors.idActor = artistlinkmusicvideo.idArtist")); if (CProfilesManager::Get().GetMasterProfile().getLockMode() != LOCK_MODE_EVERYONE && !g_passwordManager.bMasterUser) { - extFilter.fields = PrepareSQL("musicvideoview.c%02d, musicvideoview.idMVideo, actors.strActor, path.strPath", VIDEODB_ID_MUSICVIDEO_ALBUM); - extFilter.AppendJoin("join artistlinkmusicvideo on artistlinkmusicvideo.idMVideo = musicvideoview.idMVideo join actors on actors.idActor = artistlinkmusicvideo.idArtist join files on files.idFile = musicvideoview.idFile join path on path.idPath = files.idPath"); - } - else - { - extFilter.fields = PrepareSQL("musicvideoview.c%02d, musicvideoview.idMVideo, actors.strActor", VIDEODB_ID_MUSICVIDEO_ALBUM); - extFilter.AppendJoin("join artistlinkmusicvideo on artistlinkmusicvideo.idMVideo = musicvideoview.idMVideo join actors on actors.idActor = artistlinkmusicvideo.idArtist"); + extFilter.fields += " path.strPath"; + extFilter.AppendJoin("join files on files.idFile = musicvideoview.idFile join path on path.idPath = files.idPath"); } + if (idArtist > -1) - extFilter.AppendWhere(PrepareSQL("artistlinkmusicvideo.idArtist = %i", idArtist)); + videoUrl.AddOption("artistid", idArtist); extFilter.AppendGroup(PrepareSQL("musicvideoview.c%02d", VIDEODB_ID_MUSICVIDEO_ALBUM)); @@ -5244,8 +5247,7 @@ bool CVideoDatabase::GetMusicVideoAlbumsNav(const CStdString& strBaseDir, CFileI } strSQL = StringUtils::Format(strSQL.c_str(), !extFilter.fields.empty() ? extFilter.fields.c_str() : "*"); - CVideoDbUrl videoUrl; - if (!BuildSQL(strBaseDir, strSQL, extFilter, strSQL, videoUrl)) + if (!BuildSQL(videoUrl.ToString(), strSQL, extFilter, strSQL, videoUrl)) return false; int iRowsFound = RunQuery(strSQL); @@ -9870,14 +9872,19 @@ bool CVideoDatabase::GetFilter(CDbUrl &videoUrl, Filter &filter, SortDescription option = options.find("artistid"); if (option != options.end()) { - filter.AppendJoin(PrepareSQL("join artistlinkmusicvideo on artistlinkmusicvideo.idMVideo = musicvideoview.idMVideo")); + if (itemType != "albums") + filter.AppendJoin(PrepareSQL("join artistlinkmusicvideo on artistlinkmusicvideo.idMVideo = musicvideoview.idMVideo")); filter.AppendWhere(PrepareSQL("artistlinkmusicvideo.idArtist = %i", (int)option->second.asInteger())); } option = options.find("artist"); if (option != options.end()) { - filter.AppendJoin(PrepareSQL("join artistlinkmusicvideo on artistlinkmusicvideo.idMVideo = musicvideoview.idMVideo join actors on actors.idActor = artistlinkmusicvideo.idArtist")); + if (itemType != "albums") + { + filter.AppendJoin(PrepareSQL("join artistlinkmusicvideo on artistlinkmusicvideo.idMVideo = musicvideoview.idMVideo")); + filter.AppendJoin(PrepareSQL("join actors on actors.idActor = artistlinkmusicvideo.idArtist")); + } filter.AppendWhere(PrepareSQL("actors.strActor like '%s'", option->second.asString().c_str())); } diff --git a/xbmc/video/VideoDbUrl.cpp b/xbmc/video/VideoDbUrl.cpp index c01464e661..d682c96a81 100644 --- a/xbmc/video/VideoDbUrl.cpp +++ b/xbmc/video/VideoDbUrl.cpp @@ -161,7 +161,13 @@ bool CVideoDbUrl::parse() // add options based on the QueryParams if (queryParams.GetActorId() != -1) - AddOption("actorid", (int)queryParams.GetActorId()); + { + std::string optionName = "actorid"; + if (m_type == "musicvideos") + optionName = "artistid"; + + AddOption(optionName, (int)queryParams.GetActorId()); + } if (queryParams.GetAlbumId() != -1) AddOption("albumid", (int)queryParams.GetAlbumId()); if (queryParams.GetCountryId() != -1) |