Skip to content

Commit

Permalink
make movie sets conditional
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan Marshall committed May 1, 2012
1 parent c934db4 commit d38a14c
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 5 deletions.
18 changes: 18 additions & 0 deletions xbmc/GUIInfoManager.cpp
Expand Up @@ -814,6 +814,7 @@ int CGUIInfoManager::TranslateSingleString(const CStdString &strCondition)
else if (cat == "movies") return LIBRARY_HAS_MOVIES;
else if (cat == "tvshows") return LIBRARY_HAS_TVSHOWS;
else if (cat == "musicvideos") return LIBRARY_HAS_MUSICVIDEOS;
else if (cat == "moviesets") return LIBRARY_HAS_MOVIE_SETS;
}
}
else if (cat.name == "musicplayer")
Expand Down Expand Up @@ -4490,6 +4491,9 @@ void CGUIInfoManager::SetLibraryBool(int condition, bool value)
case LIBRARY_HAS_MOVIES:
m_libraryHasMovies = value ? 1 : 0;
break;
case LIBRARY_HAS_MOVIE_SETS:
m_libraryHasMovieSets = value ? 1 : 0;
break;
case LIBRARY_HAS_TVSHOWS:
m_libraryHasTVShows = value ? 1 : 0;
break;
Expand All @@ -4507,6 +4511,7 @@ void CGUIInfoManager::ResetLibraryBools()
m_libraryHasMovies = -1;
m_libraryHasTVShows = -1;
m_libraryHasMusicVideos = -1;
m_libraryHasMovieSets = -1;
}

bool CGUIInfoManager::GetLibraryBool(int condition)
Expand Down Expand Up @@ -4537,6 +4542,19 @@ bool CGUIInfoManager::GetLibraryBool(int condition)
}
return m_libraryHasMovies > 0;
}
else if (condition == LIBRARY_HAS_MOVIE_SETS)
{
if (m_libraryHasMovieSets < 0)
{
CVideoDatabase db;
if (db.Open())
{
m_libraryHasMovieSets = db.HasSets() ? 1 : 0;
db.Close();
}
}
return m_libraryHasMovieSets > 0;
}
else if (condition == LIBRARY_HAS_TVSHOWS)
{
if (m_libraryHasTVShows < 0)
Expand Down
12 changes: 7 additions & 5 deletions xbmc/GUIInfoManager.h
Expand Up @@ -376,11 +376,12 @@ namespace INFO
#define LIBRARY_HAS_MUSIC 720
#define LIBRARY_HAS_VIDEO 721
#define LIBRARY_HAS_MOVIES 722
#define LIBRARY_HAS_TVSHOWS 723
#define LIBRARY_HAS_MUSICVIDEOS 724
#define LIBRARY_IS_SCANNING 725
#define LIBRARY_IS_SCANNING_VIDEO 726
#define LIBRARY_IS_SCANNING_MUSIC 727
#define LIBRARY_HAS_MOVIE_SETS 723
#define LIBRARY_HAS_TVSHOWS 724
#define LIBRARY_HAS_MUSICVIDEOS 725
#define LIBRARY_IS_SCANNING 726
#define LIBRARY_IS_SCANNING_VIDEO 727
#define LIBRARY_IS_SCANNING_MUSIC 728

#define SYSTEM_PLATFORM_XBOX 740
#define SYSTEM_PLATFORM_LINUX 741
Expand Down Expand Up @@ -798,6 +799,7 @@ class CGUIInfoManager : public IMsgTargetCallback
int m_libraryHasMovies;
int m_libraryHasTVShows;
int m_libraryHasMusicVideos;
int m_libraryHasMovieSets;

CCriticalSection m_critInfo;
};
Expand Down

0 comments on commit d38a14c

Please sign in to comment.