Skip to content

Commit

Permalink
[videodb] - evaluate the setting for hiding watched movies/episodes in
Browse files Browse the repository at this point in the history
recently added job (should influence homescreen of skins only)
  • Loading branch information
Memphiz committed Nov 18, 2014
1 parent cff04b9 commit 19929e7
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
8 changes: 4 additions & 4 deletions xbmc/utils/RecentlyAddedJob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ bool CRecentlyAddedJob::UpdateVideo()
loader.OnLoaderStart();

videodatabase.Open();

if (videodatabase.GetRecentlyAddedMoviesNav("videodb://recentlyaddedmovies/", items, NUM_ITEMS))
bool hideWatched = CSettings::Get().GetBool("videolibrary.hiderecentlywatchedmovies");
if (videodatabase.GetRecentlyAddedMoviesNav("videodb://recentlyaddedmovies/", items, NUM_ITEMS, hideWatched))
{
for (; i < items.Size(); ++i)
{
Expand Down Expand Up @@ -97,8 +97,8 @@ bool CRecentlyAddedJob::UpdateVideo()

i = 0;
CFileItemList TVShowItems;

if (videodatabase.GetRecentlyAddedEpisodesNav("videodb://recentlyaddedepisodes/", TVShowItems, NUM_ITEMS))
hideWatched = CSettings::Get().GetBool("videolibrary.hiderecentlywatchedepisodes");
if (videodatabase.GetRecentlyAddedEpisodesNav("videodb://recentlyaddedepisodes/", TVShowItems, NUM_ITEMS, hideWatched))
{
for (; i < TVShowItems.Size(); ++i)
{
Expand Down
12 changes: 10 additions & 2 deletions xbmc/video/VideoDatabase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6596,19 +6596,27 @@ bool CVideoDatabase::GetMusicVideosNav(const CStdString& strBaseDir, CFileItemLi
return GetMusicVideosByWhere(videoUrl.ToString(), filter, items, true, sortDescription);
}

bool CVideoDatabase::GetRecentlyAddedMoviesNav(const CStdString& strBaseDir, CFileItemList& items, unsigned int limit)
bool CVideoDatabase::GetRecentlyAddedMoviesNav(const CStdString& strBaseDir, CFileItemList& items, unsigned int limit, bool hideWatched)
{
Filter filter;
filter.order = "dateAdded desc, idMovie desc";
filter.limit = PrepareSQL("%u", limit ? limit : g_advancedSettings.m_iVideoLibraryRecentlyAddedItems);

if (hideWatched)
filter.AppendWhere("playCount > 0");// only query unwatched items

return GetMoviesByWhere(strBaseDir, filter, items);
}

bool CVideoDatabase::GetRecentlyAddedEpisodesNav(const CStdString& strBaseDir, CFileItemList& items, unsigned int limit)
bool CVideoDatabase::GetRecentlyAddedEpisodesNav(const CStdString& strBaseDir, CFileItemList& items, unsigned int limit, bool hideWatched)
{
Filter filter;
filter.order = "dateAdded desc, idEpisode desc";
filter.limit = PrepareSQL("%u", limit ? limit : g_advancedSettings.m_iVideoLibraryRecentlyAddedItems);

if (hideWatched)
filter.AppendWhere("playCount > 0");// only query unwatched items

return GetEpisodesByWhere(strBaseDir, filter, items, false);
}

Expand Down
4 changes: 2 additions & 2 deletions xbmc/video/VideoDatabase.h
Original file line number Diff line number Diff line change
Expand Up @@ -650,8 +650,8 @@ class CVideoDatabase : public CDatabase
bool GetEpisodesNav(const CStdString& strBaseDir, CFileItemList& items, int idGenre=-1, int idYear=-1, int idActor=-1, int idDirector=-1, int idShow=-1, int idSeason=-1, const SortDescription &sortDescription = SortDescription());
bool GetMusicVideosNav(const CStdString& strBaseDir, CFileItemList& items, int idGenre=-1, int idYear=-1, int idArtist=-1, int idDirector=-1, int idStudio=-1, int idAlbum=-1, int idTag=-1, const SortDescription &sortDescription = SortDescription());

bool GetRecentlyAddedMoviesNav(const CStdString& strBaseDir, CFileItemList& items, unsigned int limit=0);
bool GetRecentlyAddedEpisodesNav(const CStdString& strBaseDir, CFileItemList& items, unsigned int limit=0);
bool GetRecentlyAddedMoviesNav(const CStdString& strBaseDir, CFileItemList& items, unsigned int limit=0, bool hideWatched=false);
bool GetRecentlyAddedEpisodesNav(const CStdString& strBaseDir, CFileItemList& items, unsigned int limit=0, bool hideWatched=false);
bool GetRecentlyAddedMusicVideosNav(const CStdString& strBaseDir, CFileItemList& items, unsigned int limit=0);

bool HasContent();
Expand Down

0 comments on commit 19929e7

Please sign in to comment.