Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

videodb/musicdb: remove the "filter" and "xsp" options if they don't …

…match the currently retrieved item type
  • Loading branch information...
commit 7ce8dd9d43e8f08df8c73957394c93f43bf7bb81 1 parent cbfb997
Sascha Montellese authored
2  xbmc/dbwrappers/Database.h
@@ -135,7 +135,7 @@ class CDatabase
135 135 */
136 136 bool CommitInsertQueries();
137 137
138   - virtual bool GetFilter(const CDbUrl &dbUrl, Filter &filter) { return true; }
  138 + virtual bool GetFilter(CDbUrl &dbUrl, Filter &filter) { return true; }
139 139 virtual bool BuildSQL(const CStdString &strBaseDir, const CStdString &strQuery, Filter &filter, CStdString &strSQL, CDbUrl &dbUrl);
140 140
141 141 protected:
13 xbmc/music/MusicDatabase.cpp
@@ -5262,7 +5262,7 @@ string CMusicDatabase::GetArtistArtForItem(int mediaId, const string &mediaType,
5262 5262 return GetSingleValue(query, m_pDS2);
5263 5263 }
5264 5264
5265   -bool CMusicDatabase::GetFilter(const CDbUrl &musicUrl, Filter &filter)
  5265 +bool CMusicDatabase::GetFilter(CDbUrl &musicUrl, Filter &filter)
5266 5266 {
5267 5267 if (!musicUrl.IsValid())
5268 5268 return false;
@@ -5450,8 +5450,15 @@ bool CMusicDatabase::GetFilter(const CDbUrl &musicUrl, Filter &filter)
5450 5450 if (!xspFilter.LoadFromJson(option->second.asString()))
5451 5451 return false;
5452 5452
5453   - std::set<CStdString> playlists;
5454   - filter.AppendWhere(xspFilter.GetWhereClause(*this, playlists));
  5453 + // check if the filter playlist matches the item type
  5454 + if (xspFilter.GetType() == type)
  5455 + {
  5456 + std::set<CStdString> playlists;
  5457 + filter.AppendWhere(xspFilter.GetWhereClause(*this, playlists));
  5458 + }
  5459 + // remove the filter if it doesn't match the item type
  5460 + else
  5461 + musicUrl.AddOption("filter", "");
5455 5462 }
5456 5463
5457 5464 return true;
2  xbmc/music/MusicDatabase.h
@@ -272,7 +272,7 @@ class CMusicDatabase : public CDatabase
272 272 */
273 273 std::string GetArtistArtForItem(int mediaId, const std::string &mediaType, const std::string &artType);
274 274
275   - virtual bool GetFilter(const CDbUrl &musicUrl, Filter &filter);
  275 + virtual bool GetFilter(CDbUrl &musicUrl, Filter &filter);
276 276
277 277 protected:
278 278 std::map<CStdString, int> m_artistCache;
13 xbmc/video/VideoDatabase.cpp
@@ -8982,7 +8982,7 @@ bool CVideoDatabase::GetItemsForPath(const CStdString &content, const CStdString
8982 8982 return items.Size() > 0;
8983 8983 }
8984 8984
8985   -bool CVideoDatabase::GetFilter(const CDbUrl &videoUrl, Filter &filter)
  8985 +bool CVideoDatabase::GetFilter(CDbUrl &videoUrl, Filter &filter)
8986 8986 {
8987 8987 if (!videoUrl.IsValid())
8988 8988 return false;
@@ -9407,8 +9407,15 @@ bool CVideoDatabase::GetFilter(const CDbUrl &videoUrl, Filter &filter)
9407 9407 if (!xspFilter.LoadFromJson(option->second.asString()))
9408 9408 return false;
9409 9409
9410   - std::set<CStdString> playlists;
9411   - filter.AppendWhere(xspFilter.GetWhereClause(*this, playlists));
  9410 + // check if the filter playlist matches the item type
  9411 + if (xspFilter.GetType() == itemType)
  9412 + {
  9413 + std::set<CStdString> playlists;
  9414 + filter.AppendWhere(xspFilter.GetWhereClause(*this, playlists));
  9415 + }
  9416 + // remove the filter if it doesn't match the item type
  9417 + else
  9418 + videoUrl.AddOption("filter", "");
9412 9419 }
9413 9420
9414 9421 return true;
2  xbmc/video/VideoDatabase.h
@@ -686,7 +686,7 @@ class CVideoDatabase : public CDatabase
686 686 void AddTagToItem(int idItem, int idTag, const std::string &type);
687 687 void RemoveTagFromItem(int idItem, int idTag, const std::string &type);
688 688
689   - virtual bool GetFilter(const CDbUrl &videoUrl, Filter &filter);
  689 + virtual bool GetFilter(CDbUrl &videoUrl, Filter &filter);
690 690
691 691 protected:
692 692 int GetMovieId(const CStdString& strFilenameAndPath);

0 comments on commit 7ce8dd9

Please sign in to comment.
Something went wrong with that request. Please try again.