[cstdstring] demise Format, replacing with StringUtils::Format
[vuplus_xbmc] / xbmc / filesystem / VideoDatabaseDirectory / DirectoryNodeMusicVideosOverview.cpp
1 /*
2  *      Copyright (C) 2005-2013 Team XBMC
3  *      http://xbmc.org
4  *
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)
8  *  any later version.
9  *
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.
14  *
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/>.
18  *
19  */
20
21 #include "DirectoryNodeMusicVideosOverview.h"
22 #include "FileItem.h"
23 #include "guilib/LocalizeStrings.h"
24 #include "video/VideoDbUrl.h"
25 #include "utils/StringUtils.h"
26
27 using namespace XFILE::VIDEODATABASEDIRECTORY;
28
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 }
38                             };
39
40 CDirectoryNodeMusicVideosOverview::CDirectoryNodeMusicVideosOverview(const CStdString& strName, CDirectoryNode* pParent)
41   : CDirectoryNode(NODE_TYPE_MUSICVIDEOS_OVERVIEW, strName, pParent)
42 {
43
44 }
45
46 NODE_TYPE CDirectoryNodeMusicVideosOverview::GetChildType() const
47 {
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;
51
52   return NODE_TYPE_NONE;
53 }
54
55 CStdString CDirectoryNodeMusicVideosOverview::GetLocalizedName() const
56 {
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);
60   return "";
61 }
62
63 bool CDirectoryNodeMusicVideosOverview::GetContent(CFileItemList& items) const
64 {
65   CVideoDbUrl videoUrl;
66   if (!videoUrl.FromString(BuildPath()))
67     return false;
68   
69   for (unsigned int i = 0; i < sizeof(MusicVideoChildren) / sizeof(Node); ++i)
70   {
71     CFileItemPtr pItem(new CFileItem(g_localizeStrings.Get(MusicVideoChildren[i].label)));
72
73     CVideoDbUrl itemUrl = videoUrl;
74     CStdString strDir = StringUtils::Format("%s/", MusicVideoChildren[i].id.c_str());
75     itemUrl.AppendPath(strDir);
76     pItem->SetPath(itemUrl.ToString());
77
78     pItem->m_bIsFolder = true;
79     pItem->SetCanQueue(false);
80     items.Add(pItem);
81   }
82
83   return true;
84 }
85