Permalink
Browse files

changed: made the number of recently added items in music- and videol…

…ibrary user-definable via advancedsettings.xml (defaults to 25) - fixes #6754

git-svn-id: https://xbmc.svn.sourceforge.net/svnroot/xbmc/branches/linuxport/XBMC@21070 568bbfeb-2a22-0410-94d2-cc84cf5bfa90
  • Loading branch information...
mkortstiege committed Jun 15, 2009
1 parent 6d3f22c commit 7cde6a55916368e341950350d400796a651207c6
Showing with 12 additions and 8 deletions.
  1. +3 −4 xbmc/MusicDatabase.cpp
  2. +4 −0 xbmc/Settings.cpp
  3. +2 −0 xbmc/Settings.h
  4. +3 −4 xbmc/VideoDatabase.cpp
View
@@ -59,7 +59,6 @@ using namespace MEDIA_DETECT;
#define MUSIC_DATABASE_OLD_VERSION 1.6f
#define MUSIC_DATABASE_VERSION 13
#define MUSIC_DATABASE_NAME "MyMusic7.db"
-#define RECENTLY_ADDED_LIMIT 25
#define RECENTLY_PLAYED_LIMIT 25
#define MIN_FULL_SEARCH_LENGTH 3
@@ -1413,7 +1412,7 @@ bool CMusicDatabase::GetRecentlyPlayedAlbumSongs(const CStdString& strBaseDir, C
if (NULL == m_pDS.get()) return false;
CStdString strSQL;
- strSQL.Format("select * from songview join albumview on (songview.idAlbum = albumview.idAlbum) where albumview.idalbum in (select distinct albumview.idalbum from albumview join song on albumview.idAlbum=song.idAlbum where song.lastplayed NOT NULL order by song.lastplayed desc limit %i)", RECENTLY_ADDED_LIMIT);
+ strSQL.Format("select * from songview join albumview on (songview.idAlbum = albumview.idAlbum) where albumview.idalbum in (select distinct albumview.idalbum from albumview join song on albumview.idAlbum=song.idAlbum where song.lastplayed NOT NULL order by song.lastplayed desc limit %i)", g_advancedSettings.m_iMusicLibraryRecentlyAddedItems);
CLog::Log(LOGDEBUG,"GetRecentlyPlayedAlbumSongs() query: %s", strSQL.c_str());
if (!m_pDS->query(strSQL.c_str())) return false;
@@ -1454,7 +1453,7 @@ bool CMusicDatabase::GetRecentlyAddedAlbums(VECALBUMS& albums)
if (NULL == m_pDS.get()) return false;
CStdString strSQL;
- strSQL.Format("select * from albumview order by idAlbum desc limit %i", RECENTLY_ADDED_LIMIT);
+ strSQL.Format("select * from albumview order by idAlbum desc limit %i", g_advancedSettings.m_iMusicLibraryRecentlyAddedItems);
CLog::Log(LOGDEBUG, "%s query: %s", __FUNCTION__, strSQL.c_str());
if (!m_pDS->query(strSQL.c_str())) return false;
@@ -1490,7 +1489,7 @@ bool CMusicDatabase::GetRecentlyAddedAlbumSongs(const CStdString& strBaseDir, CF
if (NULL == m_pDS.get()) return false;
CStdString strSQL;
- strSQL.Format("select songview.* from albumview join songview on (songview.idAlbum = albumview.idAlbum) where albumview.idalbum in ( select idAlbum from albumview order by idAlbum desc limit %i)", RECENTLY_ADDED_LIMIT);
+ strSQL.Format("select songview.* from albumview join songview on (songview.idAlbum = albumview.idAlbum) where albumview.idalbum in ( select idAlbum from albumview order by idAlbum desc limit %i)", g_advancedSettings.m_iMusicLibraryRecentlyAddedItems);
CLog::Log(LOGDEBUG,"GetRecentlyAddedAlbumSongs() query: %s", strSQL.c_str());
if (!m_pDS->query(strSQL.c_str())) return false;
View
@@ -275,6 +275,7 @@ void CSettings::Initialize()
g_advancedSettings.m_bMusicLibraryHideAllItems = false;
g_advancedSettings.m_bMusicLibraryAllItemsOnBottom = false;
g_advancedSettings.m_bMusicLibraryAlbumsSortByArtistThenYear = false;
+ g_advancedSettings.m_iMusicLibraryRecentlyAddedItems = 25;
g_advancedSettings.m_strMusicLibraryAlbumFormat = "";
g_advancedSettings.m_strMusicLibraryAlbumFormatRight = "";
g_advancedSettings.m_prioritiseAPEv2tags = false;
@@ -283,6 +284,7 @@ void CSettings::Initialize()
g_advancedSettings.m_bVideoLibraryHideAllItems = false;
g_advancedSettings.m_bVideoLibraryAllItemsOnBottom = false;
+ g_advancedSettings.m_iVideoLibraryRecentlyAddedItems = 25;
g_advancedSettings.m_bVideoLibraryHideRecentlyAddedItems = false;
g_advancedSettings.m_bVideoLibraryHideEmptySeries = false;
g_advancedSettings.m_bVideoLibraryCleanOnUpdate = false;
@@ -1217,6 +1219,7 @@ void CSettings::LoadAdvancedSettings()
if (pElement)
{
XMLUtils::GetBoolean(pElement, "hideallitems", g_advancedSettings.m_bMusicLibraryHideAllItems);
+ XMLUtils::GetInt(pElement, "recentlyaddeditems", g_advancedSettings.m_iMusicLibraryRecentlyAddedItems, 1, INT_MAX);
XMLUtils::GetBoolean(pElement, "prioritiseapetags", g_advancedSettings.m_prioritiseAPEv2tags);
XMLUtils::GetBoolean(pElement, "allitemsonbottom", g_advancedSettings.m_bMusicLibraryAllItemsOnBottom);
XMLUtils::GetBoolean(pElement, "albumssortbyartistthenyear", g_advancedSettings.m_bMusicLibraryAlbumsSortByArtistThenYear);
@@ -1230,6 +1233,7 @@ void CSettings::LoadAdvancedSettings()
{
XMLUtils::GetBoolean(pElement, "hideallitems", g_advancedSettings.m_bVideoLibraryHideAllItems);
XMLUtils::GetBoolean(pElement, "allitemsonbottom", g_advancedSettings.m_bVideoLibraryAllItemsOnBottom);
+ XMLUtils::GetInt(pElement, "recentlyaddeditems", g_advancedSettings.m_iVideoLibraryRecentlyAddedItems, 1, INT_MAX);
XMLUtils::GetBoolean(pElement, "hiderecentlyaddeditems", g_advancedSettings.m_bVideoLibraryHideRecentlyAddedItems);
XMLUtils::GetBoolean(pElement, "hideemptyseries", g_advancedSettings.m_bVideoLibraryHideEmptySeries);
XMLUtils::GetBoolean(pElement, "cleanonupdate", g_advancedSettings.m_bVideoLibraryCleanOnUpdate);
View
@@ -250,6 +250,7 @@ class CSettings
CStdString m_dvdThumbs;
bool m_bMusicLibraryHideAllItems;
+ int m_iMusicLibraryRecentlyAddedItems;
bool m_bMusicLibraryAllItemsOnBottom;
bool m_bMusicLibraryAlbumsSortByArtistThenYear;
CStdString m_strMusicLibraryAlbumFormat;
@@ -261,6 +262,7 @@ class CSettings
bool m_bVideoLibraryHideAllItems;
bool m_bVideoLibraryAllItemsOnBottom;
+ int m_iVideoLibraryRecentlyAddedItems;
bool m_bVideoLibraryHideRecentlyAddedItems;
bool m_bVideoLibraryHideEmptySeries;
bool m_bVideoLibraryCleanOnUpdate;
View
@@ -47,7 +47,6 @@ using namespace VIDEO;
#define VIDEO_DATABASE_VERSION 27
#define VIDEO_DATABASE_OLD_VERSION 3.f
#define VIDEO_DATABASE_NAME "MyVideos34.db"
-#define RECENTLY_ADDED_LIMIT 25
CBookmark::CBookmark()
{
@@ -4886,19 +4885,19 @@ bool CVideoDatabase::GetMusicVideosNav(const CStdString& strBaseDir, CFileItemLi
bool CVideoDatabase::GetRecentlyAddedMoviesNav(const CStdString& strBaseDir, CFileItemList& items)
{
- CStdString where = FormatSQL("order by idMovie desc limit %u",RECENTLY_ADDED_LIMIT);
+ CStdString where = FormatSQL("order by idMovie desc limit %u", g_advancedSettings.m_iVideoLibraryRecentlyAddedItems);
return GetMoviesByWhere(strBaseDir, where, items);
}
bool CVideoDatabase::GetRecentlyAddedEpisodesNav(const CStdString& strBaseDir, CFileItemList& items)
{
- CStdString where = FormatSQL("order by idepisode desc limit %u",RECENTLY_ADDED_LIMIT);
+ CStdString where = FormatSQL("order by idepisode desc limit %u", g_advancedSettings.m_iVideoLibraryRecentlyAddedItems);
return GetEpisodesByWhere(strBaseDir, where, items, false);
}
bool CVideoDatabase::GetRecentlyAddedMusicVideosNav(const CStdString& strBaseDir, CFileItemList& items)
{
- CStdString where = FormatSQL("order by idmvideo desc limit %u",RECENTLY_ADDED_LIMIT);
+ CStdString where = FormatSQL("order by idmvideo desc limit %u", g_advancedSettings.m_iVideoLibraryRecentlyAddedItems);
return GetMusicVideosByWhere(strBaseDir, where, items);
}

0 comments on commit 7cde6a5

Please sign in to comment.