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 "DirectoryNodeMusicVideosOverview.h"
23 #include "guilib/LocalizeStrings.h"
24 #include "video/VideoDbUrl.h"
25 #include "utils/StringUtils.h"
27 using namespace XFILE::VIDEODATABASEDIRECTORY;
29 Node MusicVideoChildren[] = {
30 { NODE_TYPE_GENRE, "genres", 135 },
31 { NODE_TYPE_TITLE_MUSICVIDEOS, "titles", 369 },
32 { NODE_TYPE_YEAR, "years", 562 },
33 { NODE_TYPE_ACTOR, "artists", 133 },
34 { NODE_TYPE_MUSICVIDEOS_ALBUM, "albums", 132 },
35 { NODE_TYPE_DIRECTOR, "directors", 20348 },
36 { NODE_TYPE_STUDIO, "studios", 20388 },
37 { NODE_TYPE_TAGS, "tags", 20459 }
40 CDirectoryNodeMusicVideosOverview::CDirectoryNodeMusicVideosOverview(const CStdString& strName, CDirectoryNode* pParent)
41 : CDirectoryNode(NODE_TYPE_MUSICVIDEOS_OVERVIEW, strName, pParent)
46 NODE_TYPE CDirectoryNodeMusicVideosOverview::GetChildType() const
48 for (unsigned int i = 0; i < sizeof(MusicVideoChildren) / sizeof(Node); ++i)
49 if (GetName().Equals(MusicVideoChildren[i].id.c_str()))
50 return MusicVideoChildren[i].node;
52 return NODE_TYPE_NONE;
55 CStdString CDirectoryNodeMusicVideosOverview::GetLocalizedName() const
57 for (unsigned int i = 0; i < sizeof(MusicVideoChildren) / sizeof(Node); ++i)
58 if (GetName().Equals(MusicVideoChildren[i].id.c_str()))
59 return g_localizeStrings.Get(MusicVideoChildren[i].label);
63 bool CDirectoryNodeMusicVideosOverview::GetContent(CFileItemList& items) const
66 if (!videoUrl.FromString(BuildPath()))
69 for (unsigned int i = 0; i < sizeof(MusicVideoChildren) / sizeof(Node); ++i)
71 CFileItemPtr pItem(new CFileItem(g_localizeStrings.Get(MusicVideoChildren[i].label)));
73 CVideoDbUrl itemUrl = videoUrl;
74 CStdString strDir = StringUtils::Format("%s/", MusicVideoChildren[i].id.c_str());
75 itemUrl.AppendPath(strDir);
76 pItem->SetPath(itemUrl.ToString());
78 pItem->m_bIsFolder = true;
79 pItem->SetCanQueue(false);