2 * Copyright (C) 2005-2013 Team XBMC
5 * This Program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2, or (at your option)
10 * This Program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with XBMC; see the file COPYING. If not, see
17 * <http://www.gnu.org/licenses/>.
21 #include "DirectoryNodeMoviesOverview.h"
23 #include "guilib/LocalizeStrings.h"
24 #include "video/VideoDatabase.h"
25 #include "video/VideoDbUrl.h"
27 using namespace XFILE::VIDEODATABASEDIRECTORY;
30 Node MovieChildren[] = {
31 { NODE_TYPE_GENRE, 1, 135 },
32 { NODE_TYPE_TITLE_MOVIES, 2, 369 },
33 { NODE_TYPE_YEAR, 3, 562 },
34 { NODE_TYPE_ACTOR, 4, 344 },
35 { NODE_TYPE_DIRECTOR, 5, 20348 },
36 { NODE_TYPE_STUDIO, 6, 20388 },
37 { NODE_TYPE_SETS, 7, 20434 },
38 { NODE_TYPE_COUNTRY, 8, 20451 },
39 { NODE_TYPE_TAGS, 9, 20459 }
42 CDirectoryNodeMoviesOverview::CDirectoryNodeMoviesOverview(const CStdString& strName, CDirectoryNode* pParent)
43 : CDirectoryNode(NODE_TYPE_MOVIES_OVERVIEW, strName, pParent)
48 NODE_TYPE CDirectoryNodeMoviesOverview::GetChildType() const
50 for (unsigned int i = 0; i < sizeof(MovieChildren) / sizeof(Node); ++i)
51 if (GetID() == MovieChildren[i].id)
52 return MovieChildren[i].node;
54 return NODE_TYPE_NONE;
57 CStdString CDirectoryNodeMoviesOverview::GetLocalizedName() const
59 for (unsigned int i = 0; i < sizeof(MovieChildren) / sizeof(Node); ++i)
60 if (GetID() == MovieChildren[i].id)
61 return g_localizeStrings.Get(MovieChildren[i].label);
65 bool CDirectoryNodeMoviesOverview::GetContent(CFileItemList& items) const
68 if (!videoUrl.FromString(BuildPath()))
71 for (unsigned int i = 0; i < sizeof(MovieChildren) / sizeof(Node); ++i)
76 if (db.Open() && !db.HasSets())
80 CVideoDbUrl itemUrl = videoUrl;
81 CStdString strDir; strDir.Format("%ld/", MovieChildren[i].id);
82 itemUrl.AppendPath(strDir);
84 CFileItemPtr pItem(new CFileItem(itemUrl.ToString(), true));
85 pItem->SetLabel(g_localizeStrings.Get(MovieChildren[i].label));
86 pItem->SetCanQueue(false);