Skip to content

Commit

Permalink
CFileItem: add IsLibraryFolder()
Browse files Browse the repository at this point in the history
  • Loading branch information
Montellese committed Aug 2, 2013
1 parent cb531fc commit 926ab48
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 6 deletions.
8 changes: 8 additions & 0 deletions xbmc/FileItem.cpp
Expand Up @@ -941,6 +941,14 @@ bool CFileItem::IsSmartPlayList() const
return URIUtils::HasExtension(m_strPath, ".xsp");
}

bool CFileItem::IsLibraryFolder() const
{
if (HasProperty("library.filter") && GetProperty("library.filter").asBoolean())
return true;

return URIUtils::IsLibraryFolder(m_strPath);
}

bool CFileItem::IsPlayList() const
{
return CPlayListFactory::IsPlaylist(*this);
Expand Down
1 change: 1 addition & 0 deletions xbmc/FileItem.h
Expand Up @@ -147,6 +147,7 @@ class CFileItem :
bool IsInternetStream(const bool bStrictCheck = false) const;
bool IsPlayList() const;
bool IsSmartPlayList() const;
bool IsLibraryFolder() const;
bool IsPythonScript() const;
bool IsPlugin() const;
bool IsScript() const;
Expand Down
6 changes: 6 additions & 0 deletions xbmc/utils/URIUtils.cpp
Expand Up @@ -853,6 +853,12 @@ bool URIUtils::IsAndroidApp(const CStdString &path)
return path.Left(11).Equals("androidapp:");
}

bool URIUtils::IsLibraryFolder(const CStdString& strFile)
{
CURL url(strFile);
return url.GetProtocol().Equals("library");
}

bool URIUtils::IsDOSPath(const CStdString &path)
{
if (path.size() > 1 && path[1] == ':' && isalpha(path[0]))
Expand Down
1 change: 1 addition & 0 deletions xbmc/utils/URIUtils.h
Expand Up @@ -114,6 +114,7 @@ class URIUtils
static bool IsArchive(const CStdString& strFile);
static bool IsBluray(const CStdString& strFile);
static bool IsAndroidApp(const CStdString& strFile);
static bool IsLibraryFolder(const CStdString& strFile);

static void AddSlashAtEnd(CStdString& strFolder);
static bool HasSlashAtEnd(const CStdString& strFile, bool checkURL = false);
Expand Down
8 changes: 4 additions & 4 deletions xbmc/video/GUIViewStateVideo.cpp
Expand Up @@ -479,7 +479,7 @@ CGUIViewStateVideoMovies::CGUIViewStateVideoMovies(const CFileItemList& items) :
AddSortMethod(SortByYear, 562, LABEL_MASKS("%T", "%Y", "%T", "%Y")); // Title, Year | Title, Year

const CViewState *viewState = CViewStateSettings::Get().Get("videonavtitles");
if (items.IsSmartPlayList() || items.GetProperty("library.filter").asBoolean())
if (items.IsSmartPlayList() || items.IsLibraryFolder())
AddPlaylistOrder(items, LABEL_MASKS("%T", "%R", "%T", "%R")); // Title, Rating | Title, Rating
else
{
Expand Down Expand Up @@ -516,7 +516,7 @@ CGUIViewStateVideoMusicVideos::CGUIViewStateVideoMusicVideos(const CFileItemList
AddSortMethod(SortByTrackNumber, 554, LABEL_MASKS(strTrackLeft, strTrackRight)); // Userdefined, Userdefined | empty, empty

const CViewState *viewState = CViewStateSettings::Get().Get("videonavmusicvideos");
if (items.IsSmartPlayList() || items.GetProperty("library.filter").asBoolean())
if (items.IsSmartPlayList() || items.IsLibraryFolder())
AddPlaylistOrder(items, LABEL_MASKS("%A - %T", "%Y")); // Artist - Title, Year | empty, empty
else
{
Expand All @@ -541,7 +541,7 @@ CGUIViewStateVideoTVShows::CGUIViewStateVideoTVShows(const CFileItemList& items)
AddSortMethod(SortByYear, 562, LABEL_MASKS("%T", "%Y", "%T", "%Y")); // Title, Year | Title, Year

const CViewState *viewState = CViewStateSettings::Get().Get("videonavtvshows");
if (items.IsSmartPlayList() || items.GetProperty("library.filter").asBoolean())
if (items.IsSmartPlayList() || items.IsLibraryFolder())
AddPlaylistOrder(items, LABEL_MASKS("%T", "%M", "%T", "%M")); // Title, #Episodes | Title, #Episodes
else
{
Expand Down Expand Up @@ -581,7 +581,7 @@ CGUIViewStateVideoEpisodes::CGUIViewStateVideoEpisodes(const CFileItemList& item
}

const CViewState *viewState = CViewStateSettings::Get().Get("videonavepisodes");
if (items.IsSmartPlayList() || items.GetProperty("library.filter").asBoolean())
if (items.IsSmartPlayList() || items.IsLibraryFolder())
AddPlaylistOrder(items, LABEL_MASKS("%Z - %H. %T", "%R")); // TvShow - Order. Title, Rating | empty, empty
else
{
Expand Down
2 changes: 1 addition & 1 deletion xbmc/video/windows/GUIWindowVideoNav.cpp
Expand Up @@ -1699,7 +1699,7 @@ bool CGUIWindowVideoNav::ApplyWatchedFilter(CFileItemList &items)
if (!items.IsVideoDb())
filterWatched = true;
if (items.GetContent() == "tvshows" &&
(items.IsSmartPlayList() || (items.HasProperty("library.filter") && items.GetProperty("library.filter").asBoolean())))
(items.IsSmartPlayList() || items.IsLibraryFolder()))
node = NODE_TYPE_TITLE_TVSHOWS; // so that the check below works

int watchMode = CMediaSettings::Get().GetWatchedMode(m_vecItems->GetContent());
Expand Down
2 changes: 1 addition & 1 deletion xbmc/view/GUIViewState.cpp
Expand Up @@ -82,7 +82,7 @@ CGUIViewState* CGUIViewState::GetViewState(int windowId, const CFileItemList& it
return new CGUIViewStateMusicSearch(items);

if (items.IsSmartPlayList() || url.GetProtocol() == "upnp" ||
items.GetProperty("library.filter").asBoolean())
items.IsLibraryFolder())
{
if (items.GetContent() == "songs" ||
items.GetContent() == "albums" ||
Expand Down

0 comments on commit 926ab48

Please sign in to comment.