Skip to content

Commit

Permalink
fixed: Ticket #4993 - album smartplaylists wouldn't work if an order …
Browse files Browse the repository at this point in the history
…clause was given.

git-svn-id: http://xbmc.svn.sourceforge.net/svnroot/xbmc/branches/linuxport/XBMC@16053 568bbfeb-2a22-0410-94d2-cc84cf5bfa90
  • Loading branch information
jmarshallnz authored and elan committed Oct 29, 2008
1 parent 86e4785 commit 23febb2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
3 changes: 1 addition & 2 deletions xbmc/FileSystem/SmartPlaylistDirectory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,7 @@ namespace DIRECTORY
{
CMusicDatabase db;
db.Open();
CStdString whereOrder = playlist.GetWhereClause() + " " + playlist.GetOrderClause();
success = db.GetAlbumsByWhere("musicdb://3/", whereOrder, items);
success = db.GetAlbumsByWhere("musicdb://3/", playlist.GetWhereClause(), playlist.GetOrderClause(), items);
items.SetContent("albums");
db.Close();
return success;
Expand Down
8 changes: 4 additions & 4 deletions xbmc/MusicDatabase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2522,7 +2522,7 @@ bool CMusicDatabase::GetAlbumsByYear(const CStdString& strBaseDir, CFileItemList
{
CStdString where = FormatSQL("where iYear=%ld", year);

return GetAlbumsByWhere(strBaseDir, where, items);
return GetAlbumsByWhere(strBaseDir, where, "", items);
}

bool CMusicDatabase::GetArtistsNav(const CStdString& strBaseDir, CFileItemList& items, long idGenre, bool albumArtistsOnly)
Expand Down Expand Up @@ -2803,10 +2803,10 @@ bool CMusicDatabase::GetAlbumsNav(const CStdString& strBaseDir, CFileItemList& i
, idArtist, idArtist, idArtist, idArtist);
}

return GetAlbumsByWhere(strBaseDir, strWhere, items);
return GetAlbumsByWhere(strBaseDir, strWhere, "", items);
}

bool CMusicDatabase::GetAlbumsByWhere(const CStdString &baseDir, const CStdString &where, CFileItemList &items)
bool CMusicDatabase::GetAlbumsByWhere(const CStdString &baseDir, const CStdString &where, const CStdString &order, CFileItemList &items)
{
if (NULL == m_pDB.get()) return false;
if (NULL == m_pDS.get()) return false;
Expand All @@ -2820,7 +2820,7 @@ bool CMusicDatabase::GetAlbumsByWhere(const CStdString &baseDir, const CStdStrin
sql += "where ";
else
sql += where + " and ";
sql += "albumview.strAlbum != \"\"";
sql += "albumview.strAlbum != \"\" " + order;

// run query
CLog::Log(LOGDEBUG, "%s query: %s", __FUNCTION__, sql.c_str());
Expand Down
2 changes: 1 addition & 1 deletion xbmc/MusicDatabase.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ class CMusicDatabase : public CDatabase
bool GetSongsNav(const CStdString& strBaseDir, CFileItemList& items, long idGenre, long idArtist,long idAlbum);
bool GetSongsByYear(const CStdString& baseDir, CFileItemList& items, long year);
bool GetSongsByWhere(const CStdString &baseDir, const CStdString &whereClause, CFileItemList& items);
bool GetAlbumsByWhere(const CStdString &baseDir, const CStdString &where, CFileItemList &items);
bool GetAlbumsByWhere(const CStdString &baseDir, const CStdString &where, const CStdString &order, CFileItemList &items);
bool GetRandomSong(CFileItem* item, long& lSongId, const CStdString& strWhere);
int GetSongsCount();
int GetSongsCount(const CStdString& strWhere);
Expand Down

0 comments on commit 23febb2

Please sign in to comment.