2 * Copyright (C) 2005-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
9 #include "DirectoryNodeMusicVideosOverview.h"
12 #include "FileItemList.h"
13 #include "guilib/LocalizeStrings.h"
14 #include "utils/StringUtils.h"
15 #include "video/VideoDbUrl.h"
17 using namespace XFILE::VIDEODATABASEDIRECTORY
;
19 Node MusicVideoChildren
[] = {
20 { NODE_TYPE_GENRE
, "genres", 135 },
21 { NODE_TYPE_TITLE_MUSICVIDEOS
, "titles", 10024 },
22 { NODE_TYPE_YEAR
, "years", 652 },
23 { NODE_TYPE_ACTOR
, "artists", 133 },
24 { NODE_TYPE_MUSICVIDEOS_ALBUM
, "albums", 132 },
25 { NODE_TYPE_DIRECTOR
, "directors", 20348 },
26 { NODE_TYPE_STUDIO
, "studios", 20388 },
27 { NODE_TYPE_TAGS
, "tags", 20459 }
30 CDirectoryNodeMusicVideosOverview::CDirectoryNodeMusicVideosOverview(const std::string
& strName
, CDirectoryNode
* pParent
)
31 : CDirectoryNode(NODE_TYPE_MUSICVIDEOS_OVERVIEW
, strName
, pParent
)
36 NODE_TYPE
CDirectoryNodeMusicVideosOverview::GetChildType() const
38 for (const Node
& node
: MusicVideoChildren
)
39 if (GetName() == node
.id
)
42 return NODE_TYPE_NONE
;
45 std::string
CDirectoryNodeMusicVideosOverview::GetLocalizedName() const
47 for (const Node
& node
: MusicVideoChildren
)
48 if (GetName() == node
.id
)
49 return g_localizeStrings
.Get(node
.label
);
53 bool CDirectoryNodeMusicVideosOverview::GetContent(CFileItemList
& items
) const
56 if (!videoUrl
.FromString(BuildPath()))
59 for (const Node
& node
: MusicVideoChildren
)
61 CFileItemPtr
pItem(new CFileItem(g_localizeStrings
.Get(node
.label
)));
63 CVideoDbUrl itemUrl
= videoUrl
;
64 std::string strDir
= StringUtils::Format("{}/", node
.id
);
65 itemUrl
.AppendPath(strDir
);
66 pItem
->SetPath(itemUrl
.ToString());
68 pItem
->m_bIsFolder
= true;
69 pItem
->SetCanQueue(false);
70 pItem
->SetSpecialSort(SortSpecialOnTop
);